pub trait SqlExecutor: SqlGenericExecutor {
Show 20 methods
// Required methods
async fn execute<'a>(
&'a self,
stmt: &'a str,
args: <Self::DB as Database>::Arguments<'a>,
) -> Result<u64>;
async fn execute_plain<'a>(&'a self, stmt: &'a str) -> Result<u64>;
async fn fetch_exists<'a>(
&'a self,
stmt: &'a str,
args: <Self::DB as Database>::Arguments<'a>,
) -> Result<bool>;
async fn fetch_exists_plain<'a, A>(&'a self, stmt: &'a str) -> Result<bool>;
async fn fetch_count<'s, 'a>(
&'a self,
stmt: &'s str,
args: <Self::DB as Database>::Arguments<'a>,
) -> Result<u64>
where 'a: 's;
async fn fetch_count_plain<'a>(&'a self, stmt: &'a str) -> Result<u64>;
async fn fetch_option<'a, SE>(
&'a self,
stmt: &'a str,
selection: &'a SE::Selection,
args: <Self::DB as Database>::Arguments<'a>,
) -> Result<Option<SE>>
where SE: SelectedEntity<Self::DB> + Send + Unpin;
async fn fetch_option_<'a, SE>(
&'a self,
stmt: &'a str,
selection: &'a SE,
args: <Self::DB as Database>::Arguments<'a>,
) -> Result<Option<SE>>
where SE: SelectedEntity<Self::DB> + Send + Unpin;
async fn fetch_option_plain<'a, SE>(
&'a self,
stmt: &'a str,
selection: &'a SE::Selection,
) -> Result<Option<SE>>
where SE: SelectedEntity<Self::DB> + Send + Unpin;
async fn fetch_option_plain_<'a, SE>(
&'a self,
stmt: &'a str,
selection: &'a SE,
) -> Result<Option<SE>>
where SE: SelectedEntity<Self::DB> + Send + Unpin;
async fn fetch_all<'a, SE>(
&'a self,
stmt: &'a str,
selection: &'a SE::Selection,
args: <Self::DB as Database>::Arguments<'a>,
) -> Result<Vec<SE>>
where SE: SelectedEntity<Self::DB> + Send + Unpin;
async fn fetch_all_<'a, SE>(
&'a self,
stmt: &'a str,
selection: &'a SE,
args: <Self::DB as Database>::Arguments<'a>,
) -> Result<Vec<SE>>
where SE: SelectedEntity<Self::DB> + Send + Unpin;
async fn fetch_all_plain<'a, SE>(
&'a self,
stmt: &'a str,
selection: &'a SE::Selection,
) -> Result<Vec<SE>>
where SE: SelectedEntity<Self::DB> + Send + Unpin;
async fn fetch_all_plain_<'a, SE>(
&'a self,
stmt: &'a str,
selection: &'a SE,
) -> Result<Vec<SE>>
where SE: SelectedEntity<Self::DB> + Send + Unpin;
async fn fetch_one_full<'a, SE>(
&'a self,
stmt: &'a str,
args: <Self::DB as Database>::Arguments<'a>,
) -> Result<SE>
where SE: SelectedEntity<Self::DB> + Send + Unpin;
async fn fetch_one_full_plain<'a, SE>(&'a self, stmt: &'a str) -> Result<SE>
where SE: SelectedEntity<Self::DB> + Send + Unpin;
async fn fetch_option_full<'a, SE>(
&'a self,
stmt: &'a str,
args: <Self::DB as Database>::Arguments<'a>,
) -> Result<Option<SE>>
where SE: SelectedEntity<Self::DB> + Send + Unpin;
async fn fetch_option_full_plain<'a, SE>(
&'a self,
stmt: &'a str,
) -> Result<Option<SE>>
where SE: SelectedEntity<Self::DB> + Send + Unpin;
async fn fetch_all_full<'a, SE>(
&'a self,
stmt: &'a str,
args: <Self::DB as Database>::Arguments<'a>,
) -> Result<Vec<SE>>
where SE: SelectedEntity<Self::DB> + Send + Unpin;
async fn fetch_all_full_plain<'a, SE>(
&'a self,
stmt: &'a str,
) -> Result<Vec<SE>>
where SE: SelectedEntity<Self::DB> + Send + Unpin;
}Expand description
现在sqlx::Executor的实现还是太过简陋,导致无法把不同数据库和事务的连接抽象成一个独立的实体 屏蔽掉ex,让更上层的API层不再感知connection/transaction, 这层抽象让上层实现API接口的实现可以把普通操作和事务操作合并为一份
本模块提供以下接口方法
execute (stmt, args) -> Result
fetch_exists (stmt, args) -> Result
fetch_option (stmt, selection, args) -> Result<Option
fetch_all_full (stmt, args) -> Result<Vec
Required Methods§
async fn execute<'a>( &'a self, stmt: &'a str, args: <Self::DB as Database>::Arguments<'a>, ) -> Result<u64>
async fn execute_plain<'a>(&'a self, stmt: &'a str) -> Result<u64>
async fn fetch_exists<'a>( &'a self, stmt: &'a str, args: <Self::DB as Database>::Arguments<'a>, ) -> Result<bool>
async fn fetch_exists_plain<'a, A>(&'a self, stmt: &'a str) -> Result<bool>
async fn fetch_count<'s, 'a>(
&'a self,
stmt: &'s str,
args: <Self::DB as Database>::Arguments<'a>,
) -> Result<u64>where
'a: 's,
async fn fetch_count_plain<'a>(&'a self, stmt: &'a str) -> Result<u64>
async fn fetch_option<'a, SE>( &'a self, stmt: &'a str, selection: &'a SE::Selection, args: <Self::DB as Database>::Arguments<'a>, ) -> Result<Option<SE>>
async fn fetch_option_<'a, SE>( &'a self, stmt: &'a str, selection: &'a SE, args: <Self::DB as Database>::Arguments<'a>, ) -> Result<Option<SE>>
async fn fetch_option_plain<'a, SE>( &'a self, stmt: &'a str, selection: &'a SE::Selection, ) -> Result<Option<SE>>
async fn fetch_option_plain_<'a, SE>( &'a self, stmt: &'a str, selection: &'a SE, ) -> Result<Option<SE>>
async fn fetch_all<'a, SE>( &'a self, stmt: &'a str, selection: &'a SE::Selection, args: <Self::DB as Database>::Arguments<'a>, ) -> Result<Vec<SE>>
async fn fetch_all_<'a, SE>( &'a self, stmt: &'a str, selection: &'a SE, args: <Self::DB as Database>::Arguments<'a>, ) -> Result<Vec<SE>>
async fn fetch_all_plain<'a, SE>( &'a self, stmt: &'a str, selection: &'a SE::Selection, ) -> Result<Vec<SE>>
async fn fetch_all_plain_<'a, SE>( &'a self, stmt: &'a str, selection: &'a SE, ) -> Result<Vec<SE>>
async fn fetch_one_full<'a, SE>( &'a self, stmt: &'a str, args: <Self::DB as Database>::Arguments<'a>, ) -> Result<SE>
async fn fetch_one_full_plain<'a, SE>(&'a self, stmt: &'a str) -> Result<SE>
async fn fetch_option_full<'a, SE>( &'a self, stmt: &'a str, args: <Self::DB as Database>::Arguments<'a>, ) -> Result<Option<SE>>
async fn fetch_option_full_plain<'a, SE>( &'a self, stmt: &'a str, ) -> Result<Option<SE>>
async fn fetch_all_full<'a, SE>( &'a self, stmt: &'a str, args: <Self::DB as Database>::Arguments<'a>, ) -> Result<Vec<SE>>
async fn fetch_all_full_plain<'a, SE>( &'a self, stmt: &'a str, ) -> Result<Vec<SE>>
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.