Skip to main content

ConnectionMethodsAsync

Trait ConnectionMethodsAsync 

Source
pub trait ConnectionMethodsAsync: AsyncRequiresSyncAsync {
    // Required methods
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        sql: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn query<'c, 'life0, 'life1, 'life2, 'async_trait>(
        &'c self,
        table: &'life0 str,
        columns: &'life1 [Column],
        expr: Option<BoolExpr>,
        limit: Option<i32>,
        offset: Option<i32>,
        sort: Option<&'life2 [Order]>,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn BackendRows + 'c>, Error>> + Send + 'async_trait>>
       where 'c: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn insert_returning_pk<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        columns: &'life2 [Column],
        pkcol: &'life3 Column,
        values: &'life4 [SqlValRef<'life5>],
    ) -> Pin<Box<dyn Future<Output = Result<SqlVal, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             'life5: 'async_trait,
             Self: 'async_trait;
    fn insert_only<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        columns: &'life2 [Column],
        values: &'life3 [SqlValRef<'life4>],
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             Self: 'async_trait;
    fn insert_or_replace<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        columns: &'life2 [Column],
        pkcol: &'life3 Column,
        values: &'life4 [SqlValRef<'life5>],
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             'life5: 'async_trait,
             Self: 'async_trait;
    fn update<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        pkcol: Column,
        pk: SqlValRef<'life2>,
        columns: &'life3 [Column],
        values: &'life4 [SqlValRef<'life5>],
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             'life5: 'async_trait,
             Self: 'async_trait;
    fn delete_where<'life0, 'life1, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        expr: BoolExpr,
    ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn has_table<'life0, 'life1, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        pkcol: &'static str,
        pk: SqlVal,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: Sync + 'async_trait { ... }
}
Expand description

Methods available on a database connection. Most users do not need to call these methods directly and will instead use methods on DataObject or the query! macro. This trait is implemented by both database connections and transactions.

Required Methods§

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, sql: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source

fn query<'c, 'life0, 'life1, 'life2, 'async_trait>( &'c self, table: &'life0 str, columns: &'life1 [Column], expr: Option<BoolExpr>, limit: Option<i32>, offset: Option<i32>, sort: Option<&'life2 [Order]>, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn BackendRows + 'c>, Error>> + Send + 'async_trait>>
where 'c: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Source

fn insert_returning_pk<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, table: &'life1 str, columns: &'life2 [Column], pkcol: &'life3 Column, values: &'life4 [SqlValRef<'life5>], ) -> Pin<Box<dyn Future<Output = Result<SqlVal, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, Self: 'async_trait,

Source

fn insert_only<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, table: &'life1 str, columns: &'life2 [Column], values: &'life3 [SqlValRef<'life4>], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Self: 'async_trait,

Like insert_returning_pk but with no return value.

Source

fn insert_or_replace<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, table: &'life1 str, columns: &'life2 [Column], pkcol: &'life3 Column, values: &'life4 [SqlValRef<'life5>], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, Self: 'async_trait,

Insert unless there’s a conflict on the primary key column, in which case update.

Source

fn update<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, table: &'life1 str, pkcol: Column, pk: SqlValRef<'life2>, columns: &'life3 [Column], values: &'life4 [SqlValRef<'life5>], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, Self: 'async_trait,

Source

fn delete_where<'life0, 'life1, 'async_trait>( &'life0 self, table: &'life1 str, expr: BoolExpr, ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source

fn has_table<'life0, 'life1, 'async_trait>( &'life0 self, table: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Tests if a table exists in the database.

Provided Methods§

Source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, table: &'life1 str, pkcol: &'static str, pk: SqlVal, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl ConnectionMethodsAsync for Box<dyn BackendConnectionAsync>

Source§

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, sql: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn BackendConnectionAsync>: 'async_trait,

Source§

fn query<'c, 'life0, 'life1, 'life2, 'async_trait>( &'c self, table: &'life0 str, columns: &'life1 [Column], expr: Option<BoolExpr>, limit: Option<i32>, offset: Option<i32>, sort: Option<&'life2 [Order]>, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn BackendRows + 'c>, Error>> + Send + 'async_trait>>
where 'c: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Box<dyn BackendConnectionAsync>: 'async_trait,

Source§

fn insert_returning_pk<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, table: &'life1 str, columns: &'life2 [Column], pkcol: &'life3 Column, values: &'life4 [SqlValRef<'life5>], ) -> Pin<Box<dyn Future<Output = Result<SqlVal, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, Box<dyn BackendConnectionAsync>: 'async_trait,

Source§

fn insert_only<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, table: &'life1 str, columns: &'life2 [Column], values: &'life3 [SqlValRef<'life4>], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Box<dyn BackendConnectionAsync>: 'async_trait,

Source§

fn insert_or_replace<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, table: &'life1 str, columns: &'life2 [Column], pkcol: &'life3 Column, values: &'life4 [SqlValRef<'life5>], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, Box<dyn BackendConnectionAsync>: 'async_trait,

Source§

fn update<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, table: &'life1 str, pkcol: Column, pk: SqlValRef<'life2>, columns: &'life3 [Column], values: &'life4 [SqlValRef<'life5>], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, Box<dyn BackendConnectionAsync>: 'async_trait,

Source§

fn delete_where<'life0, 'life1, 'async_trait>( &'life0 self, table: &'life1 str, expr: BoolExpr, ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn BackendConnectionAsync>: 'async_trait,

Source§

fn has_table<'life0, 'life1, 'async_trait>( &'life0 self, table: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn BackendConnectionAsync>: 'async_trait,

Source§

impl<'bt> ConnectionMethodsAsync for Box<dyn BackendTransactionAsync<'bt> + 'bt>

Source§

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, sql: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn BackendTransactionAsync<'bt> + 'bt>: 'async_trait,

Source§

fn query<'c, 'life0, 'life1, 'life2, 'async_trait>( &'c self, table: &'life0 str, columns: &'life1 [Column], expr: Option<BoolExpr>, limit: Option<i32>, offset: Option<i32>, sort: Option<&'life2 [Order]>, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn BackendRows + 'c>, Error>> + Send + 'async_trait>>
where 'c: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Box<dyn BackendTransactionAsync<'bt> + 'bt>: 'async_trait,

Source§

fn insert_returning_pk<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, table: &'life1 str, columns: &'life2 [Column], pkcol: &'life3 Column, values: &'life4 [SqlValRef<'life5>], ) -> Pin<Box<dyn Future<Output = Result<SqlVal, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, Box<dyn BackendTransactionAsync<'bt> + 'bt>: 'async_trait,

Source§

fn insert_only<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, table: &'life1 str, columns: &'life2 [Column], values: &'life3 [SqlValRef<'life4>], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Box<dyn BackendTransactionAsync<'bt> + 'bt>: 'async_trait,

Source§

fn insert_or_replace<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, table: &'life1 str, columns: &'life2 [Column], pkcol: &'life3 Column, values: &'life4 [SqlValRef<'life5>], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, Box<dyn BackendTransactionAsync<'bt> + 'bt>: 'async_trait,

Source§

fn update<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, table: &'life1 str, pkcol: Column, pk: SqlValRef<'life2>, columns: &'life3 [Column], values: &'life4 [SqlValRef<'life5>], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, Box<dyn BackendTransactionAsync<'bt> + 'bt>: 'async_trait,

Source§

fn delete_where<'life0, 'life1, 'async_trait>( &'life0 self, table: &'life1 str, expr: BoolExpr, ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn BackendTransactionAsync<'bt> + 'bt>: 'async_trait,

Source§

fn has_table<'life0, 'life1, 'async_trait>( &'life0 self, table: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn BackendTransactionAsync<'bt> + 'bt>: 'async_trait,

Implementors§