Replies: 1 comment 4 replies
|
Hey @siketyan, thanks for asking!! I think there is a better approach than that? |
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Related thread on Discord: https://discord.com/channels/873880840487206962/1045022584162500728
The problem
SeaORM can query their managed entities using a query generated by SeaQuery, but that needs the following code to be written every time:
This is a little complicated, so I am consindering to utilise this, for example:
Implementation
To achieve this, we should modify both SeaORM and SeaQuery.
First, *Statement structs such as SelectStatement has a method
to_string, but this is not in any trait.It's ok to just implement the SeaQuery to SeaORM conversion, but SeaORM's dependency to SeaQuery here will be much compilcated.
To avoid this and to help future extensions, I think we should define a new trait in SeaQuery and implement it on *Statement structs:
Next, we need to add a method on
StatementlikeStatement::from_query.I am considering the following signature for it:
Any idea on this?
I am going to work on this if this idea were agreed from the community and/or contributors.
Thank you for reading!
All reactions