pub trait DatabaseHooks<DB: DatabaseAdapter>: Send + Sync {
Show 20 methods
// 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 { ... }
fn before_create_account<'life0, 'life1, 'async_trait>(
&'life0 self,
account: &'life1 mut CreateAccount,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn after_create_account<'life0, 'life1, 'async_trait>(
&'life0 self,
account: &'life1 DB::Account,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn before_update_account<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
update: &'life2 mut UpdateAccount,
) -> 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_account<'life0, 'life1, 'async_trait>(
&'life0 self,
account: &'life1 DB::Account,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn before_delete_account<'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_account<'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_verification<'life0, 'life1, 'async_trait>(
&'life0 self,
verification: &'life1 mut CreateVerification,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn after_create_verification<'life0, 'life1, 'async_trait>(
&'life0 self,
verification: &'life1 DB::Verification,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn before_delete_verification<'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_verification<'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 { ... }
}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).