pub trait DatabaseClient {
    // Required method
    fn raw_batch<'life0, 'async_trait>(
        &'life0 self,
        stmts: impl 'async_trait + IntoIterator<Item = impl 'async_trait + Into<Statement>>
    ) -> Pin<Box<dyn Future<Output = Result<BatchResult>> + '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<StmtResult>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn batch<'life0, 'async_trait>(
        &'life0 self,
        stmts: impl 'async_trait + IntoIterator<Item = impl 'async_trait + Into<Statement>>
    ) -> Pin<Box<dyn Future<Output = Result<BatchResult>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn transaction<'a, 'async_trait>(
        &'a self
    ) -> Pin<Box<dyn Future<Output = Result<Transaction<'a, Self>>> + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait { ... }
}
Expand description

Trait describing capabilities of a database client:

  • executing statements, batches, transactions

Required Methods§

source

fn raw_batch<'life0, 'async_trait>( &'life0 self, stmts: impl 'async_trait + IntoIterator<Item = impl 'async_trait + Into<Statement>> ) -> Pin<Box<dyn Future<Output = Result<BatchResult>> + '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<StmtResult>> + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Executes a single SQL statement

Arguments
  • stmt - the SQL statement
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<BatchResult>> + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

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

Arguments
  • stmts - SQL statements
source

fn transaction<'a, 'async_trait>( &'a self ) -> Pin<Box<dyn Future<Output = Result<Transaction<'a, Self>>> + 'async_trait>>where Self: 'async_trait, 'a: 'async_trait,

Starts an interactive transaction and returns a Transaction object. The object can be later used to execute(), commit() or rollback() the interactive transaction.

Implementors§

source§

impl DatabaseClient for GenericClient

source§

impl DatabaseClient for libsql_client::hrana::Client

source§

impl DatabaseClient for libsql_client::local::Client

source§

impl DatabaseClient for libsql_client::reqwest::Client

source§

impl DatabaseClient for libsql_client::spin::Client

source§

impl DatabaseClient for libsql_client::workers::Client