diff --git a/examples/basic/src/example_cake.rs b/examples/basic/src/example_cake.rs index b3364df8..6d877ac6 100644 --- a/examples/basic/src/example_cake.rs +++ b/examples/basic/src/example_cake.rs @@ -37,4 +37,12 @@ impl Related for Entity { } } -impl ActiveModelBehavior for ActiveModel {} +#[async_trait::async_trait] +impl ActiveModelBehavior for ActiveModel { + async fn before_save(self, _db: &C, _insert: bool) -> Result + where + C: ConnectionTrait, + { + Ok(self) + } +} diff --git a/src/entity/prelude.rs b/src/entity/prelude.rs index 47b22bcc..2e69f9c0 100644 --- a/src/entity/prelude.rs +++ b/src/entity/prelude.rs @@ -1,9 +1,9 @@ pub use crate::{ error::*, ActiveEnum, ActiveModelBehavior, ActiveModelTrait, ColumnDef, ColumnTrait, - ColumnType, ColumnTypeTrait, CursorTrait, DatabaseConnection, DbConn, EntityName, EntityTrait, - EnumIter, ForeignKeyAction, Iden, IdenStatic, Linked, LoaderTrait, ModelTrait, PaginatorTrait, - PrimaryKeyToColumn, PrimaryKeyTrait, QueryFilter, QueryResult, Related, RelationDef, - RelationTrait, Select, Value, + ColumnType, ColumnTypeTrait, ConnectionTrait, CursorTrait, DatabaseConnection, DbConn, + EntityName, EntityTrait, EnumIter, ForeignKeyAction, Iden, IdenStatic, Linked, LoaderTrait, + ModelTrait, PaginatorTrait, PrimaryKeyToColumn, PrimaryKeyTrait, QueryFilter, QueryResult, + Related, RelationDef, RelationTrait, Select, Value, }; #[cfg(feature = "macros")] @@ -13,6 +13,8 @@ pub use crate::{ DerivePrimaryKey, DeriveRelation, FromJsonQueryResult, }; +pub use async_trait; + #[cfg(feature = "with-json")] pub use serde_json::Value as Json;