sea-orm icon indicating copy to clipboard operation
sea-orm copied to clipboard

feat: implement `IntoSimpleExpr` for `FunctionCall`, `ColumnRef`, `Keyword` and `CaseStatement`

Open billy1624 opened this issue 2 years ago • 5 comments

PR Info

  • Closes https://github.com/SeaQL/sea-orm/issues/1601

Changes

  • [x] Implement IntoSimpleExpr for FunctionCall, ColumnRef, Keyword and CaseStatement

billy1624 avatar Apr 25 '23 10:04 billy1624

@billy1624 hello! I think this is not all types... For example:

  1. https://docs.rs/sea-query/latest/sea_query/extension/postgres/enum.PgFunction.html
  2. https://docs.rs/sea-query/latest/sea_query/extension/postgres/struct.PgFunc.html
  3. https://docs.rs/sea-query/latest/sea_query/extension/sqlite/trait.SqliteExpr.html

ikrivosheev avatar Apr 25 '23 10:04 ikrivosheev

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 avatar May 02 '23 09:05 billy1624

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

tyt2y3 avatar May 15 '23 12:05 tyt2y3

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!

ikrivosheev avatar May 15 '23 13:05 ikrivosheev

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 :)

billy1624 avatar May 29 '23 13:05 billy1624