Trait sea_orm::query::ConnectionTrait[][src]

pub trait ConnectionTrait<'a>: Sync {
    type Stream: Stream<Item = Result<QueryResult, DbErr>>;
    fn get_database_backend(&self) -> DbBackend;
fn execute<'life0, 'async_trait>(
        &'life0 self,
        stmt: Statement
    ) -> Pin<Box<dyn Future<Output = Result<ExecResult, DbErr>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn query_one<'life0, 'async_trait>(
        &'life0 self,
        stmt: Statement
    ) -> Pin<Box<dyn Future<Output = Result<Option<QueryResult>, DbErr>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn query_all<'life0, 'async_trait>(
        &'life0 self,
        stmt: Statement
    ) -> Pin<Box<dyn Future<Output = Result<Vec<QueryResult>, DbErr>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn stream(
        &'a self,
        stmt: Statement
    ) -> Pin<Box<dyn Future<Output = Result<Self::Stream, DbErr>> + 'a>>;
fn begin<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<DatabaseTransaction, DbErr>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn transaction<'life0, 'async_trait, F, T, E>(
        &'life0 self,
        callback: F
    ) -> Pin<Box<dyn Future<Output = Result<T, TransactionError<E>>> + Send + 'async_trait>>
    where
        F: for<'c> FnOnce(&'c DatabaseTransaction) -> Pin<Box<dyn Future<Output = Result<T, E>> + Send + 'c>> + Send,
        T: Send,
        E: Error + Send,
        F: 'async_trait,
        T: 'async_trait,
        E: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
; fn support_returning(&self) -> bool { ... }
fn is_mock_connection(&self) -> bool { ... } }
Expand description

Creates constraints for any structure that can create a database connection and execute SQL statements

Associated Types

Create a stream for the QueryResult

Required methods

Fetch the database backend as specified in DbBackend. This depends on feature flags enabled.

Execute a Statement

Execute a Statement and return a query

Execute a Statement and return a collection Vec<QueryResult> on success

Execute a Statement and return a stream of results

Execute SQL BEGIN transaction. Returns a Transaction that can be committed or rolled back

Execute the function inside a transaction. If the function returns an error, the transaction will be rolled back. If it does not return an error, the transaction will be committed.

Provided methods

Check if the connection supports RETURNING syntax on insert and update

Check if the connection is a test connection for the Mock database

Implementors