Skip to main content

DatabaseTransaction

Trait DatabaseTransaction 

Source
pub trait DatabaseTransaction: Send + Sync {
    // Required methods
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        query: DatabaseQuery,
    ) -> Pin<Box<dyn Future<Output = AppResult<DatabaseResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn commit<'async_trait>(
        self: Box<Self>,
    ) -> Pin<Box<dyn Future<Output = AppResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn rollback<'async_trait>(
        self: Box<Self>,
    ) -> Pin<Box<dyn Future<Output = AppResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

Active database transaction.

Required Methods§

Source

fn execute<'life0, 'async_trait>( &'life0 self, query: DatabaseQuery, ) -> Pin<Box<dyn Future<Output = AppResult<DatabaseResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute a statement inside the transaction.

Source

fn commit<'async_trait>( self: Box<Self>, ) -> Pin<Box<dyn Future<Output = AppResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,

Commit the transaction.

Source

fn rollback<'async_trait>( self: Box<Self>, ) -> Pin<Box<dyn Future<Output = AppResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,

Roll back the transaction.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§