Rename to DeriveEntityModel
This commit is contained in:
parent
022bee0627
commit
0fff7fd054
@ -1,6 +1,6 @@
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, EntityModel)]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, DeriveModel, DeriveActiveModel)]
|
||||
#[sea_orm(table_name = "cake")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
|
@ -15,6 +15,22 @@ pub fn derive_entity(input: TokenStream) -> TokenStream {
|
||||
}
|
||||
}
|
||||
|
||||
#[proc_macro_derive(DeriveEntityModel, attributes(sea_orm))]
|
||||
pub fn derive_entity_model(input: TokenStream) -> TokenStream {
|
||||
let DeriveInput {
|
||||
ident, data, attrs, ..
|
||||
} = parse_macro_input!(input as DeriveInput);
|
||||
|
||||
if ident != "Model" {
|
||||
panic!("Struct name must be Model");
|
||||
}
|
||||
|
||||
match derives::expand_derive_entity_model(data, attrs) {
|
||||
Ok(ts) => ts.into(),
|
||||
Err(e) => e.to_compile_error().into(),
|
||||
}
|
||||
}
|
||||
|
||||
#[proc_macro_derive(DerivePrimaryKey)]
|
||||
pub fn derive_primary_key(input: TokenStream) -> TokenStream {
|
||||
let DeriveInput { ident, data, .. } = parse_macro_input!(input);
|
||||
@ -108,17 +124,3 @@ pub fn test(_: TokenStream, input: TokenStream) -> TokenStream {
|
||||
)
|
||||
.into()
|
||||
}
|
||||
|
||||
#[proc_macro_derive(EntityModel, attributes(sea_orm))]
|
||||
pub fn derive_entity_model(input: TokenStream) -> TokenStream {
|
||||
let DeriveInput { ident, data, attrs, .. } = parse_macro_input!(input as DeriveInput);
|
||||
|
||||
if ident != "Model" {
|
||||
panic!("Struct name must be Model");
|
||||
}
|
||||
|
||||
match derives::expand_derive_entity_model(data, attrs) {
|
||||
Ok(ts) => ts.into(),
|
||||
Err(e) => e.to_compile_error().into(),
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
pub use crate::{
|
||||
error::*, ActiveModelBehavior, ActiveModelTrait, ColumnDef, ColumnTrait, ColumnType,
|
||||
DeriveActiveModel, DeriveActiveModelBehavior, DeriveColumn, DeriveCustomColumn, DeriveEntity,
|
||||
DeriveModel, DerivePrimaryKey, EntityModel, EntityName, EntityTrait, EnumIter, ForeignKeyAction, Iden,
|
||||
IdenStatic, Linked, ModelTrait, PrimaryKeyToColumn, PrimaryKeyTrait, QueryFilter, QueryResult,
|
||||
Related, RelationDef, RelationTrait, Select, Value,
|
||||
DeriveEntityModel, DeriveModel, DerivePrimaryKey, EntityName, EntityTrait, EnumIter,
|
||||
ForeignKeyAction, Iden, IdenStatic, Linked, ModelTrait, PrimaryKeyToColumn, PrimaryKeyTrait,
|
||||
QueryFilter, QueryResult, Related, RelationDef, RelationTrait, Select, Value,
|
||||
};
|
||||
|
||||
#[cfg(feature = "with-json")]
|
||||
|
@ -227,7 +227,7 @@ pub use query::*;
|
||||
|
||||
pub use sea_orm_macros::{
|
||||
DeriveActiveModel, DeriveActiveModelBehavior, DeriveColumn, DeriveCustomColumn, DeriveEntity,
|
||||
DeriveModel, DerivePrimaryKey, FromQueryResult, EntityModel,
|
||||
DeriveEntityModel, DeriveModel, DerivePrimaryKey, FromQueryResult,
|
||||
};
|
||||
|
||||
pub use sea_query;
|
||||
|
Loading…
x
Reference in New Issue
Block a user