use crate::error::OrmResult;
use async_trait::async_trait;
use sqlx::PgPool;
#[async_trait]
pub trait Hooks: Sized + Send + Sync + 'static {
async fn before_save(&mut self, _pool: &PgPool) -> OrmResult<()> {
Ok(())
}
async fn after_save(&self, _pool: &PgPool) -> OrmResult<()> {
Ok(())
}
async fn before_create(&mut self, _pool: &PgPool) -> OrmResult<()> {
Ok(())
}
async fn after_create(&self, _pool: &PgPool) -> OrmResult<()> {
Ok(())
}
async fn before_update(&mut self, _pool: &PgPool) -> OrmResult<()> {
Ok(())
}
async fn after_update(&self, _pool: &PgPool) -> OrmResult<()> {
Ok(())
}
async fn before_delete(&self, _pool: &PgPool) -> OrmResult<()> {
Ok(())
}
async fn after_delete(&self, _pool: &PgPool) -> OrmResult<()> {
Ok(())
}
}