Skip to main content

Database

Trait Database 

Source
pub trait Database: Send + Sync {
    // Required methods
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        stmt: &'life1 Statement,
    ) -> Pin<Box<dyn Future<Output = Result<u64, DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn query<'life0, 'life1, 'async_trait>(
        &'life0 self,
        stmt: &'life1 Statement,
    ) -> Pin<Box<dyn Future<Output = Result<Rows, DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn batch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        stmts: &'life1 [Statement],
    ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Execute statements against the venture database. Implementations: D1 (Workers), rusqlite (tests, self-hosted), Postgres (phase 3).

batch runs all statements in one unit of work where the engine supports it (a transaction on SQLite and D1’s atomic batch); documented per adapter.

Required Methods§

Source

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

Source

fn query<'life0, 'life1, 'async_trait>( &'life0 self, stmt: &'life1 Statement, ) -> Pin<Box<dyn Future<Output = Result<Rows, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn batch<'life0, 'life1, 'async_trait>( &'life0 self, stmts: &'life1 [Statement], ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§