Skip to main content

DatabaseConnection

Trait DatabaseConnection 

Source
pub trait DatabaseConnection: Send + Sync {
    // Required methods
    fn query<'life0, 'life1, 'async_trait>(
        &'life0 self,
        sql: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<DatabaseRows>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn query_with<'life0, 'life1, 'async_trait>(
        &'life0 self,
        sql: &'life1 str,
        params: Vec<Value>,
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<DatabaseRows>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        sql: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn execute_with<'life0, 'life1, 'async_trait>(
        &'life0 self,
        sql: &'life1 str,
        params: Vec<Value>,
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn prepare<'life0, 'life1, 'async_trait>(
        &'life0 self,
        sql: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<DatabaseStatement>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn query_with_turso<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _sql: &'life1 str,
        _params: Vec<Value>,
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<DatabaseRows>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn execute_with_turso<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _sql: &'life1 str,
        _params: Vec<Value>,
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

数据库连接抽象

Required Methods§

Source

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

执行查询,返回结果集

Source

fn query_with<'life0, 'life1, 'async_trait>( &'life0 self, sql: &'life1 str, params: Vec<Value>, ) -> Pin<Box<dyn Future<Output = DatabaseResult<DatabaseRows>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

执行带参数的查询 (使用 wae_types::Value)

Source

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

执行语句,返回影响的行数

Source

fn execute_with<'life0, 'life1, 'async_trait>( &'life0 self, sql: &'life1 str, params: Vec<Value>, ) -> Pin<Box<dyn Future<Output = DatabaseResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

执行带参数的语句 (使用 wae_types::Value)

Source

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

准备语句

Provided Methods§

Source

fn query_with_turso<'life0, 'life1, 'async_trait>( &'life0 self, _sql: &'life1 str, _params: Vec<Value>, ) -> Pin<Box<dyn Future<Output = DatabaseResult<DatabaseRows>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

执行带参数的查询 (内部使用 turso::Value)

Source

fn execute_with_turso<'life0, 'life1, 'async_trait>( &'life0 self, _sql: &'life1 str, _params: Vec<Value>, ) -> Pin<Box<dyn Future<Output = DatabaseResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

执行带参数的语句 (内部使用 turso::Value)

Implementors§