pub trait IAsyncConnection: Send + Sync {
// Required methods
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
sql: &'life1 str,
params: &'life2 [DbValue],
) -> Pin<Box<dyn Future<Output = EFResult<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,
sql: &'life1 str,
params: &'life2 [DbValue],
) -> Pin<Box<dyn Future<Output = EFResult<Vec<Vec<DbValue>>>> + 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 = EFResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn commit_transaction<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn rollback_transaction<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn create_savepoint<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn release_savepoint<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn rollback_to_savepoint<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn set_transaction_isolation<'life0, 'async_trait>(
&'life0 mut self,
level: IsolationLevel,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn discard(self: Box<Self>);
// Provided method
fn begin_transaction_with<'life0, 'async_trait>(
&'life0 mut self,
level: IsolationLevel,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Trait for async database connections.
Required Methods§
Sourcefn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
sql: &'life1 str,
params: &'life2 [DbValue],
) -> Pin<Box<dyn Future<Output = EFResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
sql: &'life1 str,
params: &'life2 [DbValue],
) -> Pin<Box<dyn Future<Output = EFResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Executes a query with parameters and returns the number of affected rows.
Sourcefn query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
sql: &'life1 str,
params: &'life2 [DbValue],
) -> Pin<Box<dyn Future<Output = EFResult<Vec<Vec<DbValue>>>> + 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,
sql: &'life1 str,
params: &'life2 [DbValue],
) -> Pin<Box<dyn Future<Output = EFResult<Vec<Vec<DbValue>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Executes a query with parameters and returns rows.
Sourcefn begin_transaction<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn begin_transaction<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Begins a transaction.
Sourcefn commit_transaction<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn commit_transaction<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Commits the current transaction.
Sourcefn rollback_transaction<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn rollback_transaction<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Rolls back the current transaction.
Sourcefn create_savepoint<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_savepoint<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Creates a savepoint within the current transaction.
Sourcefn release_savepoint<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn release_savepoint<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Releases (commits) a previously created savepoint, discarding its rollback point.
Sourcefn rollback_to_savepoint<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn rollback_to_savepoint<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Rolls back to the named savepoint, preserving the outer transaction.
Sourcefn set_transaction_isolation<'life0, 'async_trait>(
&'life0 mut self,
level: IsolationLevel,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_transaction_isolation<'life0, 'async_trait>(
&'life0 mut self,
level: IsolationLevel,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sets the isolation level of the current transaction.
Provider-dependent: PostgreSQL accepts this after BEGIN and before the
first query; MySQL requires the level at START TRANSACTION time and
rejects this call. Prefer begin_transaction_with.
Sourcefn discard(self: Box<Self>)
fn discard(self: Box<Self>)
Synchronously discards the underlying connection without returning it to the pool.
Used when a transaction is dropped unfinished or a commit/rollback fails: closing the connection lets the database roll back any open transaction, and prevents a poisoned connection from being reused.
Provided Methods§
Sourcefn begin_transaction_with<'life0, 'async_trait>(
&'life0 mut self,
level: IsolationLevel,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn begin_transaction_with<'life0, 'async_trait>(
&'life0 mut self,
level: IsolationLevel,
) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Begins a transaction with the requested isolation level.
The default implementation begins the transaction and then calls
set_transaction_isolation. Providers
whose database requires the isolation level before the transaction
starts (MySQL) override this method.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".