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§
Sourcefn 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 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,
执行查询
Sourcefn 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>>
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>>
获取所有结果
Sourcefn fetch_one_query<'q, 'life0, 'async_trait, T>(
&'life0 mut self,
query: &'q str,
) -> Pin<Box<dyn Future<Output = Result<T>> + Send + '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>>
获取单行结果
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.