Skip to main content

DbExecutor

Trait DbExecutor 

Source
pub trait DbExecutor<'c>: Send + Sync {
    // Required methods
    fn execute_query<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        query: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<MySqlQueryResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn fetch_all_query<'q, 'life0, 'async_trait, T>(
        &'life0 mut self,
        query: &'q str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<T>>> + Send + 'async_trait>>
       where T: Send + Unpin + for<'r> FromRow<'r, MySqlRow> + 'async_trait,
             Self: 'async_trait,
             'q: 'async_trait,
             'life0: 'async_trait;
    fn fetch_one_query<'q, 'life0, 'async_trait, T>(
        &'life0 mut self,
        query: &'q str,
    ) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>
       where T: Send + Unpin + for<'r> FromRow<'r, MySqlRow> + 'async_trait,
             Self: 'async_trait,
             'q: 'async_trait,
             'life0: 'async_trait;
    fn fetch_optional_query<'q, 'life0, 'async_trait, T>(
        &'life0 mut self,
        query: &'q str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>
       where T: Send + Unpin + for<'r> FromRow<'r, MySqlRow> + 'async_trait,
             Self: 'async_trait,
             'q: 'async_trait,
             'life0: 'async_trait;
}
Expand description

数据库执行器内部特征

为连接池和事务提供统一的执行接口。

Required Methods§

Source

fn execute_query<'life0, 'life1, 'async_trait>( &'life0 mut self, query: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<MySqlQueryResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

执行查询

Source

fn fetch_all_query<'q, 'life0, 'async_trait, T>( &'life0 mut self, query: &'q str, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>>> + Send + 'async_trait>>
where T: Send + Unpin + for<'r> FromRow<'r, MySqlRow> + 'async_trait, Self: 'async_trait, 'q: 'async_trait, 'life0: 'async_trait,

获取所有结果

Source

fn fetch_one_query<'q, 'life0, 'async_trait, T>( &'life0 mut self, query: &'q str, ) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>
where T: Send + Unpin + for<'r> FromRow<'r, MySqlRow> + 'async_trait, Self: 'async_trait, 'q: 'async_trait, 'life0: 'async_trait,

获取单行结果

Source

fn fetch_optional_query<'q, 'life0, 'async_trait, T>( &'life0 mut self, query: &'q str, ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>
where T: Send + Unpin + for<'r> FromRow<'r, MySqlRow> + 'async_trait, Self: 'async_trait, 'q: 'async_trait, 'life0: 'async_trait,

获取可选的单行结果

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<'c> DbExecutor<'c> for Pool<MySql>

Source§

fn execute_query<'life0, 'life1, 'async_trait>( &'life0 mut self, query: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<MySqlQueryResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn fetch_all_query<'q, 'life0, 'async_trait, T>( &'life0 mut self, query: &'q str, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>>> + Send + 'async_trait>>
where T: Send + Unpin + for<'r> FromRow<'r, MySqlRow> + 'async_trait, Self: 'async_trait, 'q: 'async_trait, 'life0: 'async_trait,

Source§

fn fetch_one_query<'q, 'life0, 'async_trait, T>( &'life0 mut self, query: &'q str, ) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>
where T: Send + Unpin + for<'r> FromRow<'r, MySqlRow> + 'async_trait, Self: 'async_trait, 'q: 'async_trait, 'life0: 'async_trait,

Source§

fn fetch_optional_query<'q, 'life0, 'async_trait, T>( &'life0 mut self, query: &'q str, ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>
where T: Send + Unpin + for<'r> FromRow<'r, MySqlRow> + 'async_trait, Self: 'async_trait, 'q: 'async_trait, 'life0: 'async_trait,

Source§

impl<'c> DbExecutor<'c> for Transaction<'c, MySql>

Source§

fn execute_query<'life0, 'life1, 'async_trait>( &'life0 mut self, query: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<MySqlQueryResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn fetch_all_query<'q, 'life0, 'async_trait, T>( &'life0 mut self, query: &'q str, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>>> + Send + 'async_trait>>
where T: Send + Unpin + for<'r> FromRow<'r, MySqlRow> + 'async_trait, Self: 'async_trait, 'q: 'async_trait, 'life0: 'async_trait,

Source§

fn fetch_one_query<'q, 'life0, 'async_trait, T>( &'life0 mut self, query: &'q str, ) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>
where T: Send + Unpin + for<'r> FromRow<'r, MySqlRow> + 'async_trait, Self: 'async_trait, 'q: 'async_trait, 'life0: 'async_trait,

Source§

fn fetch_optional_query<'q, 'life0, 'async_trait, T>( &'life0 mut self, query: &'q str, ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>
where T: Send + Unpin + for<'r> FromRow<'r, MySqlRow> + 'async_trait, Self: 'async_trait, 'q: 'async_trait, 'life0: 'async_trait,

Implementors§