Skip to main content

ConnectionTrait

Trait ConnectionTrait 

Source
pub trait ConnectionTrait: Send + Sync {
    // Required methods
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        statement: Statement,
    ) -> Pin<Box<dyn Future<Output = Result<ExecResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn execute_unprepared<'life0, 'life1, 'async_trait>(
        &'life0 self,
        sql: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<ExecResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn query_one<'life0, 'async_trait>(
        &'life0 self,
        statement: Statement,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Row>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn query_all<'life0, 'async_trait>(
        &'life0 self,
        statement: Statement,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Row>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Executes statements and fetches rows.

§Errors

Every method returns Error::Turso when the engine rejects the statement — with ErrorKind::Busy under lock contention, ErrorKind::Constraint on a constraint violation and ErrorKind::Other otherwise. The Database implementation additionally returns Error::PoolTimeout when no connection is free within the acquire timeout.

Required Methods§

Source

fn execute<'life0, 'async_trait>( &'life0 self, statement: Statement, ) -> Pin<Box<dyn Future<Output = Result<ExecResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Runs a statement that returns no rows.

Source

fn execute_unprepared<'life0, 'life1, 'async_trait>( &'life0 self, sql: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ExecResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Runs one or more ;-separated statements without parameters.

Source

fn query_one<'life0, 'async_trait>( &'life0 self, statement: Statement, ) -> Pin<Box<dyn Future<Output = Result<Option<Row>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetches at most one row.

Source

fn query_all<'life0, 'async_trait>( &'life0 self, statement: Statement, ) -> Pin<Box<dyn Future<Output = Result<Vec<Row>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetches all rows.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§