Tweak ActiveModelBehavior
This commit is contained in:
parent
6caf530d21
commit
05ccb1b644
@ -4,8 +4,6 @@ use syn::Data;
|
|||||||
|
|
||||||
pub fn expand_derive_active_model_behavior(_ident: Ident, _data: Data) -> syn::Result<TokenStream> {
|
pub fn expand_derive_active_model_behavior(_ident: Ident, _data: Data) -> syn::Result<TokenStream> {
|
||||||
Ok(quote!(
|
Ok(quote!(
|
||||||
impl sea_orm::ActiveModelBehavior for ActiveModel {
|
impl sea_orm::ActiveModelBehavior for ActiveModel {}
|
||||||
type Entity = Entity;
|
|
||||||
}
|
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -62,8 +62,6 @@ pub trait ActiveModelTrait: Clone + Debug {
|
|||||||
|
|
||||||
/// Behaviors for users to override
|
/// Behaviors for users to override
|
||||||
pub trait ActiveModelBehavior: ActiveModelTrait {
|
pub trait ActiveModelBehavior: ActiveModelTrait {
|
||||||
type Entity: EntityTrait;
|
|
||||||
|
|
||||||
/// Create a new ActiveModel with default values. Also used by `Default::default()`.
|
/// Create a new ActiveModel with default values. Also used by `Default::default()`.
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
<Self as ActiveModelTrait>::default()
|
<Self as ActiveModelTrait>::default()
|
||||||
|
@ -80,6 +80,4 @@ impl Model {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
type Entity = Entity;
|
|
||||||
}
|
|
||||||
|
@ -60,6 +60,4 @@ impl RelationTrait for Relation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
type Entity = Entity;
|
|
||||||
}
|
|
||||||
|
@ -63,6 +63,4 @@ impl Model {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
type Entity = Entity;
|
|
||||||
}
|
|
||||||
|
@ -50,6 +50,4 @@ impl RelationTrait for Relation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
type Entity = Entity;
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user