pub trait Hooks:
Sized
+ Send
+ Sync
+ 'static {
// Provided methods
fn before_save<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn after_save<'life0, 'life1, 'async_trait>(
&'life0 self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn before_create<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn after_create<'life0, 'life1, 'async_trait>(
&'life0 self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn before_update<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn after_update<'life0, 'life1, 'async_trait>(
&'life0 self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn before_delete<'life0, 'life1, 'async_trait>(
&'life0 self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn after_delete<'life0, 'life1, 'async_trait>(
&'life0 self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Хуки жизненного цикла модели.
Реализуйте только те методы, которые нужны.
Все методы по умолчанию — no-op (возвращают Ok(())).
Provided Methods§
Sourcefn before_save<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn before_save<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Перед любым сохранением (INSERT или UPDATE).
Sourcefn after_save<'life0, 'life1, 'async_trait>(
&'life0 self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn after_save<'life0, 'life1, 'async_trait>(
&'life0 self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
После любого сохранения.
Sourcefn before_create<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn before_create<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Перед INSERT.
Sourcefn after_create<'life0, 'life1, 'async_trait>(
&'life0 self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn after_create<'life0, 'life1, 'async_trait>(
&'life0 self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
После INSERT.
Sourcefn before_update<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn before_update<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Перед UPDATE.
Sourcefn after_update<'life0, 'life1, 'async_trait>(
&'life0 self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn after_update<'life0, 'life1, 'async_trait>(
&'life0 self,
_pool: &'life1 PgPool,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
После UPDATE.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.