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§
Sourcefn 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 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.
Sourcefn backend_name(&self) -> &'static str
fn backend_name(&self) -> &'static str
Retrieve the backend name for this connection.
Trait Implementations§
Source§impl BackendConnectionAsync for Box<dyn BackendConnectionAsync>
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,
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_name(&self) -> &'static str
fn backend_name(&self) -> &'static str
Retrieve the backend name for this connection.
Source§impl ConnectionMethodsAsync for Box<dyn BackendConnectionAsync>
impl ConnectionMethodsAsync for Box<dyn BackendConnectionAsync>
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,
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,
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,
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,
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.
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,
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,
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.