You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am reviving #90 because I had time to mature our solution and I think it is relevant to the general community.
Almost all our Iden look like:
use sea_query::Iden;#[derive(Iden,Clone)]pubenumResponses{Table,Id,StatusCode,Raw,Length,RoundtripTime,CreatedAt,}implResponses{pubfnall_table_columns() -> Vec<(Responses,Responses)>{vec![(Responses::Table,Responses::Id),(Responses::Table,Responses::StatusCode),(Responses::Table,Responses::Raw),(Responses::Table,Responses::Length),(Responses::Table,Responses::RoundtripTime),(Responses::Table,Responses::CreatedAt),]}pubfnall_columns() -> Vec<Responses>{vec![Responses::Id,Responses::StatusCode,Responses::Raw,Responses::Length,Responses::RoundtripTime,Responses::CreatedAt,]}}
This is super useful for query building because you have a central place to change if you add a new column to your table.
Both methods needed since sometimes you can't specify a table name (like in a CTE scenario), but most of the time you want to specify the table name.
Proposed Solutions
I think we should add a way to generate those methods or a variant of them with the Iden macro.
Or maybe it could be another macro like IdenIter.
I would also try to get rid of the Vec if possible and maybe even add some helpers on the Iterator.
I could see something like Responses::all_columns().except(Responses::Length)
Additional Information
I tried EnumIter but it really it not as convenient because of the need to add the table name.
The text was updated successfully, but these errors were encountered:
Motivation
I am reviving #90 because I had time to mature our solution and I think it is relevant to the general community.
Almost all our Iden look like:
This is super useful for query building because you have a central place to change if you add a new column to your table.
Both methods needed since sometimes you can't specify a table name (like in a CTE scenario), but most of the time you want to specify the table name.
Proposed Solutions
I think we should add a way to generate those methods or a variant of them with the
Iden
macro.Or maybe it could be another macro like
IdenIter
.I would also try to get rid of the
Vec
if possible and maybe even add some helpers on the Iterator.I could see something like
Responses::all_columns().except(Responses::Length)
Additional Information
I tried
EnumIter
but it really it not as convenient because of the need to add the table name.The text was updated successfully, but these errors were encountered: