-
-
Notifications
You must be signed in to change notification settings - Fork 195
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Select all columns #90
Comments
Since use strum::EnumIter;
use sea_query::{Iden, Query};
#[derive(Iden, EnumIter)]
enum MyModel {
Id,
MyColumn,
/* etc */
}
Query::select().columns(MyModel::iter()) |
Will use it, still think it would be a good idea to have the |
An Iden implementation on a struct will only give a single column reference. If you wish to associate multiple iden's to a single struct you're still going to need an enum and associate it to the struct. If you want this to all be automatically derived, you're looking for an ORM. |
Right that make sense. I usually prefer query builders. The Iden on struct could generate Iden for all fields too or generate a DSL but I guess that would be more for an ORM. |
I think thats also in the ORM territory, since you still need to generate a list of something that implements iden. Since iden cannot give a stringified list because the query builder quotes the output of that string. You could make that it returns a list of |
@Progdrasil thank you for helping out |
@tyt2y3 I am most likely going to continue using the query builder because I have complex queries with a lot of conditionals and joins that are usually very hard to express in an ORM (thus our switch from diesel to sea-query). |
Now that SeaORM is 'public', please take a look and see if it helps! |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Hi!
I could not find an easy way to specify all columns (but not star).
Maybe Iden could implement an
all()
function that returns a vec?It would look like:
Thanks!
The text was updated successfully, but these errors were encountered: