Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement IntoSimpleExpr for FunctionCall, ColumnRef, Keyword and CaseStatement #1613

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

billy1624
Copy link
Member

@billy1624 billy1624 commented Apr 25, 2023

PR Info

Changes

  • Implement IntoSimpleExpr for FunctionCall, ColumnRef, Keyword and CaseStatement

@billy1624 billy1624 self-assigned this Apr 25, 2023
@billy1624
Copy link
Member Author

Hey @ikrivosheev, I think we shouldn't implement IntoSimpleExpr for the types below.

  1. https://docs.rs/sea-query/latest/sea_query/extension/postgres/enum.PgFunction.html (will not be used directly, instead user should construct it via PgFunc)
  2. https://docs.rs/sea-query/latest/sea_query/extension/postgres/struct.PgFunc.html (stateless and each method of it returns a FunctionCall which already implemented IntoSimpleExpr
  3. https://docs.rs/sea-query/latest/sea_query/extension/sqlite/trait.SqliteExpr.html (this is a trait which extend the functionality of Expression)

@billy1624 billy1624 marked this pull request as ready for review May 2, 2023 10:34
@billy1624 billy1624 requested a review from tyt2y3 May 2, 2023 10:38
@billy1624 billy1624 changed the title feat: implement IntoSimpleExpr for FunctionCall, ColumnRef and Keyword feat: implement IntoSimpleExpr for FunctionCall, ColumnRef, Keyword and CaseStatement May 12, 2023
@tyt2y3
Copy link
Member

tyt2y3 commented May 15, 2023

This is a rather benign addition, so may be we can add a few unit tests? Just to make sure it compiles.

@ikrivosheev
Copy link
Member

Hey @ikrivosheev, I think we shouldn't implement IntoSimpleExpr for the types below.

1. https://docs.rs/sea-query/latest/sea_query/extension/postgres/enum.PgFunction.html (will not be used directly, instead user should construct it via `PgFunc`)

2. https://docs.rs/sea-query/latest/sea_query/extension/postgres/struct.PgFunc.html (stateless and each method of it returns a `FunctionCall` which already implemented `IntoSimpleExpr`

3. https://docs.rs/sea-query/latest/sea_query/extension/sqlite/trait.SqliteExpr.html (this is a trait which extend the functionality of `Expression`)

Thank you for explain!

@billy1624
Copy link
Member Author

This is a rather benign addition, so may be we can add a few unit tests? Just to make sure it compiles.

Just added a few test cases. Please check :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Review
Development

Successfully merging this pull request may close these issues.

A FunctionCall cannot be used in .column_as() because it does not implement IntoSimpleExpr
4 participants