-
-
Notifications
You must be signed in to change notification settings - Fork 486
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
Entity format #135
Entity format #135
Conversation
EntityModel derive-macro
Looking awesome! We don't want to use the shorter Also, if we wanted this to be more correct (something I even forgot to do), we should add Do you think it's worth updating all the macros to take in an macro_rules! create_derive {
($name:ident $(, $( $attrs:ident ),+)?) => {
paste! {
#[proc_macro_derive($name, attributes($( $( $attrs ),*)?))]
pub fn [< $name:snake >](input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as DeriveInput);
derives::[<expand_ $name:snake>](input)
.unwrap_or_else(Error::into_compile_error)
.into()
}
}
}
}
create_derive!(DeriveEntity, sea);
create_derive!(DerivePrimaryKey);
create_derive!(DeriveColumn);
create_derive!(DeriveCustomColumn);
create_derive!(DeriveModel, sea);
create_derive!(DeriveModelColumn, sea);
create_derive!(DeriveModelPrimaryKey, sea);
create_derive!(DeriveActiveModel);
create_derive!(DeriveActiveModelBehavior);
create_derive!(DeriveRelation, sea);
create_derive!(FromQueryResult); (the macro above works with the paste crate) |
I guess the norm is to use the crate's name itself?
I think it's fine if someone wants to alias something else as sea_orm.
Yes I do think it's a good idea. |
I think it's fine having a shorter version, nothing will conflict with
Sure, it's a very small thing. But I think it's usually a standard thing when writing macros, mainly for |
I hope sea-orm/src/tests_cfg/fruit.rs Line 1 in a186338
|
#105