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 saw we're using some magic to inject graphql derives to Model, Relation and ActiveEnum. It's not future proof and depends heavily on the output of SeaORM codegen. Let say, the sea_orm attribute comes before derive, then the inject_graphql code will fail.
// `inject_graphql` expect this as the input#[derive(Clone,Debug,PartialEq,DeriveEntityModel)]#[sea_orm(table_name = "actor")]pubstructModel{#[sea_orm(primary_key)]pubactor_id:u16,pubfirst_name:String,publast_name:String,publast_update:DateTimeUtc,}// How about this?#[sea_orm(table_name = "actor")]#[derive(Clone,Debug,PartialEq,DeriveEntityModel)]pubstructModel{#[sea_orm(primary_key)]pubactor_id:u16,pubfirst_name:String,publast_name:String,publast_update:DateTimeUtc,}
We can provide extension inside SeaORM codegen. For example, EntityWriterContext can store a Option<dyn ExtendModelStructWriter> where we can specify additional derives and attributes for the generated Model. The trait will take some context provided by the SeaORM codegen. Feel free to rename it or even take the context as &EntityWriterContext.
I saw we're using some magic to inject graphql derives to
Model
,Relation
andActiveEnum
. It's not future proof and depends heavily on the output of SeaORM codegen. Let say, thesea_orm
attribute comes beforederive
, then theinject_graphql
code will fail.We can provide extension inside SeaORM codegen. For example,
EntityWriterContext
can store aOption<dyn ExtendModelStructWriter>
where we can specify additional derives and attributes for the generatedModel
. The trait will take some context provided by the SeaORM codegen. Feel free to rename it or even take the context as&EntityWriterContext
.The text was updated successfully, but these errors were encountered: