pub trait Connection {
    // Required method
    fn batch<'life0, 'async_trait>(
        &'life0 self,
        stmts: impl 'async_trait + IntoIterator<Item = impl 'async_trait + Into<Statement>>
    ) -> Pin<Box<dyn Future<Output = Result<Vec<QueryResult>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        stmt: impl 'async_trait + Into<Statement>
    ) -> Pin<Box<dyn Future<Output = Result<QueryResult>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn transaction<'life0, 'async_trait>(
        &'life0 self,
        stmts: impl 'async_trait + IntoIterator<Item = impl 'async_trait + Into<Statement>>
    ) -> Pin<Box<dyn Future<Output = Result<Vec<QueryResult>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Trait describing capabilities of a database connection:

  • executing statements, batches, transactions

Required Methods§

source

fn batch<'life0, 'async_trait>( &'life0 self, stmts: impl 'async_trait + IntoIterator<Item = impl 'async_trait + Into<Statement>> ) -> Pin<Box<dyn Future<Output = Result<Vec<QueryResult>>> + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Executes a batch of SQL statements. Each statement is going to run in its own transaction, unless they’re wrapped in BEGIN and END

Arguments
  • stmts - SQL statements

Provided Methods§

source

fn execute<'life0, 'async_trait>( &'life0 self, stmt: impl 'async_trait + Into<Statement> ) -> Pin<Box<dyn Future<Output = Result<QueryResult>> + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Executes a single SQL statement

Arguments
  • stmt - the SQL statement
source

fn transaction<'life0, 'async_trait>( &'life0 self, stmts: impl 'async_trait + IntoIterator<Item = impl 'async_trait + Into<Statement>> ) -> Pin<Box<dyn Future<Output = Result<Vec<QueryResult>>> + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Executes an SQL transaction. Does not support nested transactions - do not use BEGIN or END inside a transaction.

Arguments
  • stmts - SQL statements

Implementors§

source§

impl Connection for GenericConnection

source§

impl Connection for libsql_client::local::Connection

source§

impl Connection for libsql_client::reqwest::Connection