SeaQL / sea-query

🔱 A dynamic SQL query builder for MySQL, Postgres and SQLite
https://www.sea-ql.org
Other
1.18k stars 195 forks source link

Visibility of fields of FunctionCall inadvertently changed to pub(crate) #676

Closed magbak closed 1 year ago

magbak commented 1 year ago

Description

In the bugfix #475 of issue #398, the enum variant SimpleExpr::FunctionCall(Function, Vec) was replaced by SimpleExpr::FunctionCall(FunctionCall). Since the fields of the struct FunctionCall are pub(crate), and the struct has no accessors, it is no longer possible to inspect the internals of a function. This functionality is essential for SQL-rewriting, and necessary to be able to make assertions about functions without making SQL-text.

Steps to Reproduce

Try to access FunctionCall args outside sea-query.

Expected Behavior

Have access to the inner structure of a function when using sea-query as a library, such as with e.g. SimpleExpr::Binary.

Actual Behavior

Inner structure of FunctionCall hidden from library users.

Reproduces How Often

Always.

Versions

Since the introduction of #475

Additional Information

Suggest either changing visibility of fields or providing pub getters if inappropriate ways of constructing FunctionCall is a concern. Please let me know if I should make a pull request.

tyt2y3 commented 1 year ago

Sure. I think pub getters are the way to go. PR is welcomed!