DatabaseConnection

Trait DatabaseConnection 

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

Abstract database connection trait

Required Methods§

Source

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

Execute a query and return affected rows count

Source

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

Execute a query and return the result rows

Source

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

Execute a query and return the first result row

Source

fn begin_transaction<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = OrmResult<Box<dyn DatabaseTransaction>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Begin a transaction

Source

fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Close the connection

Implementors§