Skip to main content

IAsyncConnection

Trait IAsyncConnection 

Source
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;

    // 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§

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Provided Methods§

Source

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".

Implementors§