BackendConnectionAsync

Trait BackendConnectionAsync 

Source
pub trait BackendConnectionAsync:
    ConnectionMethodsAsync
    + Debug
    + Send {
    // Required methods
    fn transaction<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<TransactionAsync<'life0>, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn backend(&self) -> Box<dyn Backend>;
    fn backend_name(&self) -> &'static str;
    fn is_closed(&self) -> bool;
}
Expand description

Database connection.

Required Methods§

Source

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

Begin a database transaction. The transaction object must be used in place of this connection until it is committed or aborted.

Source

fn backend(&self) -> Box<dyn Backend>

Retrieve the backend for this connection.

Source

fn backend_name(&self) -> &'static str

Retrieve the backend name for this connection.

Source

fn is_closed(&self) -> bool

Tests if the connection has been closed. Backends which do not support this check should return false.

Trait Implementations§

Source§

impl BackendConnectionAsync for Box<dyn BackendConnectionAsync>

Source§

fn transaction<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<TransactionAsync<'life0>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Box<dyn BackendConnectionAsync>: 'async_trait,

Begin a database transaction. The transaction object must be used in place of this connection until it is committed or aborted.
Source§

fn backend(&self) -> Box<dyn Backend>

Retrieve the backend for this connection.
Source§

fn backend_name(&self) -> &'static str

Retrieve the backend name for this connection.
Source§

fn is_closed(&self) -> bool

Tests if the connection has been closed. Backends which do not support this check should return false.
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,

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, Box<dyn BackendConnectionAsync>: '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, 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,

Tests if a table exists in the database.
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,

Implementations on Foreign Types§

Source§

impl BackendConnectionAsync for Box<dyn BackendConnectionAsync>

Source§

fn transaction<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<TransactionAsync<'life0>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Box<dyn BackendConnectionAsync>: 'async_trait,

Source§

fn backend(&self) -> Box<dyn Backend>

Source§

fn backend_name(&self) -> &'static str

Source§

fn is_closed(&self) -> bool

Implementors§