1use crate::error::OrmResult;
2use async_trait::async_trait;
3use sqlx::PgPool;
4
5#[async_trait]
10pub trait Hooks: Sized + Send + Sync + 'static {
11 async fn before_save(&mut self, _pool: &PgPool) -> OrmResult<()> {
13 Ok(())
14 }
15 async fn after_save(&self, _pool: &PgPool) -> OrmResult<()> {
17 Ok(())
18 }
19 async fn before_create(&mut self, _pool: &PgPool) -> OrmResult<()> {
21 Ok(())
22 }
23 async fn after_create(&self, _pool: &PgPool) -> OrmResult<()> {
25 Ok(())
26 }
27 async fn before_update(&mut self, _pool: &PgPool) -> OrmResult<()> {
29 Ok(())
30 }
31 async fn after_update(&self, _pool: &PgPool) -> OrmResult<()> {
33 Ok(())
34 }
35 async fn before_delete(&self, _pool: &PgPool) -> OrmResult<()> {
37 Ok(())
38 }
39 async fn after_delete(&self, _pool: &PgPool) -> OrmResult<()> {
41 Ok(())
42 }
43}