Skip to main content

DatabaseHooks

Trait DatabaseHooks 

Source
pub trait DatabaseHooks<DB: DatabaseAdapter>: Send + Sync {
    // Provided methods
    fn before_create_user<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user: &'life1 mut CreateUser,
    ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn after_create_user<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user: &'life1 DB::User,
    ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn before_update_user<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
        update: &'life2 mut UpdateUser,
    ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn after_update_user<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user: &'life1 DB::User,
    ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn before_delete_user<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn after_delete_user<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn before_create_session<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session: &'life1 mut CreateSession,
    ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn after_create_session<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session: &'life1 DB::Session,
    ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn before_delete_session<'life0, 'life1, 'async_trait>(
        &'life0 self,
        token: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn after_delete_session<'life0, 'life1, 'async_trait>(
        &'life0 self,
        token: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Database lifecycle hooks for intercepting operations.

All methods have default no-op implementations. Override only the hooks you need. Returning Err from a before_* hook aborts the operation.

The DB type parameter determines the concrete entity types used in after_* hooks (e.g., after_create_user receives &DB::User).

Provided Methods§

Source

fn before_create_user<'life0, 'life1, 'async_trait>( &'life0 self, user: &'life1 mut CreateUser, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn after_create_user<'life0, 'life1, 'async_trait>( &'life0 self, user: &'life1 DB::User, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn before_update_user<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 str, update: &'life2 mut UpdateUser, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn after_update_user<'life0, 'life1, 'async_trait>( &'life0 self, user: &'life1 DB::User, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn before_delete_user<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn after_delete_user<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn before_create_session<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 mut CreateSession, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn after_create_session<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 DB::Session, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn before_delete_session<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn after_delete_session<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§