Update prelude

This commit is contained in:
Chris Tsang 2023-01-29 11:34:28 +08:00
parent 342d057833
commit 5ffd8025f2
2 changed files with 15 additions and 5 deletions

View File

@ -37,4 +37,12 @@ impl Related<super::filling::Entity> for Entity {
} }
} }
impl ActiveModelBehavior for ActiveModel {} #[async_trait::async_trait]
impl ActiveModelBehavior for ActiveModel {
async fn before_save<C>(self, _db: &C, _insert: bool) -> Result<Self, DbErr>
where
C: ConnectionTrait,
{
Ok(self)
}
}

View File

@ -1,9 +1,9 @@
pub use crate::{ pub use crate::{
error::*, ActiveEnum, ActiveModelBehavior, ActiveModelTrait, ColumnDef, ColumnTrait, error::*, ActiveEnum, ActiveModelBehavior, ActiveModelTrait, ColumnDef, ColumnTrait,
ColumnType, ColumnTypeTrait, CursorTrait, DatabaseConnection, DbConn, EntityName, EntityTrait, ColumnType, ColumnTypeTrait, ConnectionTrait, CursorTrait, DatabaseConnection, DbConn,
EnumIter, ForeignKeyAction, Iden, IdenStatic, Linked, LoaderTrait, ModelTrait, PaginatorTrait, EntityName, EntityTrait, EnumIter, ForeignKeyAction, Iden, IdenStatic, Linked, LoaderTrait,
PrimaryKeyToColumn, PrimaryKeyTrait, QueryFilter, QueryResult, Related, RelationDef, ModelTrait, PaginatorTrait, PrimaryKeyToColumn, PrimaryKeyTrait, QueryFilter, QueryResult,
RelationTrait, Select, Value, Related, RelationDef, RelationTrait, Select, Value,
}; };
#[cfg(feature = "macros")] #[cfg(feature = "macros")]
@ -13,6 +13,8 @@ pub use crate::{
DerivePrimaryKey, DeriveRelation, FromJsonQueryResult, DerivePrimaryKey, DeriveRelation, FromJsonQueryResult,
}; };
pub use async_trait;
#[cfg(feature = "with-json")] #[cfg(feature = "with-json")]
pub use serde_json::Value as Json; pub use serde_json::Value as Json;