Skip to main content

DatabaseTransaction

Trait DatabaseTransaction 

Source
pub trait DatabaseTransaction: Send + Sync {
    // Required methods
    fn execute<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        query: &'life1 str,
        params: &'life2 [DatabaseValue],
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn query<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        query: &'life1 str,
        params: &'life2 [DatabaseValue],
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<Vec<Box<dyn DatabaseRow>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn query_one<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        query: &'life1 str,
        params: &'life2 [DatabaseValue],
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<Option<Box<dyn DatabaseRow>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn commit<'async_trait>(
        self: Box<Self>,
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn rollback<'async_trait>(
        self: Box<Self>,
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

Database transaction interface

Required Methods§

Source

fn execute<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, query: &'life1 str, params: &'life2 [DatabaseValue], ) -> Pin<Box<dyn Future<Output = DatabaseResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Execute a query within the transaction that returns no rows

Source

fn query<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, query: &'life1 str, params: &'life2 [DatabaseValue], ) -> Pin<Box<dyn Future<Output = DatabaseResult<Vec<Box<dyn DatabaseRow>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Execute a query within the transaction that returns rows

Source

fn query_one<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, query: &'life1 str, params: &'life2 [DatabaseValue], ) -> Pin<Box<dyn Future<Output = DatabaseResult<Option<Box<dyn DatabaseRow>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Execute a query within the transaction that returns a single row

Source

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

Commit the transaction

Source

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

Rollback the transaction

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§