Struct rbatis::executor::RBatisTxExecutor [−][src]
Fields
conn: DBTx
rb: &'a Rbatis
Implementations
pub fn defer<Call>(self, callback: Call) -> RBatisTxExecutorGuard<'a> where
Call: 'a + FnMut(Self) + Send,
pub fn defer<Call>(self, callback: Call) -> RBatisTxExecutorGuard<'a> where
Call: 'a + FnMut(Self) + Send,
defer an func for example: tx.defer(|tx| {});
pub fn defer_async<R, F>(self, callback: F) -> RBatisTxExecutorGuard<'a> where
R: 'a + Future<Output = ()>,
F: 'a + Send + FnMut(RBatisTxExecutor<'a>) -> R,
pub fn defer_async<R, F>(self, callback: F) -> RBatisTxExecutorGuard<'a> where
R: 'a + Future<Output = ()>,
F: 'a + Send + FnMut(RBatisTxExecutor<'a>) -> R,
defer and use future method for example: tx.defer_async(|tx| async { tx.rollback().await; });
pub async fn fetch_page<T>(
&self,
sql: &str,
args: &Vec<Value>,
page_request: &dyn IPageRequest
) -> Result<Page<T>> where
T: DeserializeOwned + Serialize + Send + Sync,
Methods from Deref<Target = DBTx>
pub async fn fetch<T>(&'_ mut self, sql: &'q str) -> Result<(T, usize), Error> where
T: DeserializeOwned,
pub async fn fetch_parperd<T>(
&'_ mut self,
sql: DBQuery<'q>
) -> Result<(T, usize), Error> where
T: DeserializeOwned,
Trait Implementations
fn save_by_wrapper<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 mut self,
table: &'life1 T,
w: &'life2 Wrapper,
skips: &'life3 [Skip<'_>]
) -> Pin<Box<dyn Future<Output = Result<DBExecResult>> + Send + 'async_trait>> where
T: CRUDTable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: Send + 'async_trait,
fn save_by_wrapper<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 mut self,
table: &'life1 T,
w: &'life2 Wrapper,
skips: &'life3 [Skip<'_>]
) -> Pin<Box<dyn Future<Output = Result<DBExecResult>> + Send + 'async_trait>> where
T: CRUDTable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: Send + 'async_trait,
save by wrapper
fn save<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
table: &'life1 T,
skips: &'life2 [Skip<'_>]
) -> Pin<Box<dyn Future<Output = Result<DBExecResult>> + Send + 'async_trait>> where
T: CRUDTable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
fn save<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
table: &'life1 T,
skips: &'life2 [Skip<'_>]
) -> Pin<Box<dyn Future<Output = Result<DBExecResult>> + Send + 'async_trait>> where
T: CRUDTable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
save one entity to database
fn save_batch<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
tables: &'life1 [T],
skips: &'life2 [Skip<'_>]
) -> Pin<Box<dyn Future<Output = Result<DBExecResult>> + Send + 'async_trait>> where
T: CRUDTable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
fn save_batch<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
tables: &'life1 [T],
skips: &'life2 [Skip<'_>]
) -> Pin<Box<dyn Future<Output = Result<DBExecResult>> + Send + 'async_trait>> where
T: CRUDTable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
save batch makes many value into only one sql. make sure your data do not too long! Read more
fn save_batch_slice<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
tables: &'life1 [T],
slice_len: usize,
skips: &'life2 [Skip<'_>]
) -> Pin<Box<dyn Future<Output = Result<DBExecResult>> + Send + 'async_trait>> where
T: CRUDTable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
fn save_batch_slice<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
tables: &'life1 [T],
slice_len: usize,
skips: &'life2 [Skip<'_>]
) -> Pin<Box<dyn Future<Output = Result<DBExecResult>> + Send + 'async_trait>> where
T: CRUDTable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
save batch slice makes many value into many sql. make sure your slice_len do not too long! slice_len = 0 : save all data slice_len != 0 : save data with slice_len everytime until save all data Read more
remove database record by a wrapper
fn remove_by_column<'life0, 'life1, 'life2, 'async_trait, T, C>(
&'life0 mut self,
column: &'life1 str,
value: &'life2 C
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDTable,
C: Serialize + Send + Sync,
T: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
fn remove_by_column<'life0, 'life1, 'life2, 'async_trait, T, C>(
&'life0 mut self,
column: &'life1 str,
value: &'life2 C
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDTable,
C: Serialize + Send + Sync,
T: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
remove database record by id
fn remove_batch_by_column<'life0, 'life1, 'life2, 'async_trait, T, C>(
&'life0 mut self,
column: &'life1 str,
values: &'life2 [C]
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDTable,
C: Serialize + Send + Sync,
T: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
fn remove_batch_by_column<'life0, 'life1, 'life2, 'async_trait, T, C>(
&'life0 mut self,
column: &'life1 str,
values: &'life2 [C]
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDTable,
C: Serialize + Send + Sync,
T: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
remove batch id
for Example :
rb.remove_batch_by_column::
fn update_by_wrapper<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 mut self,
table: &'life1 T,
w: &'life2 Wrapper,
skips: &'life3 [Skip<'_>]
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDTable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: Send + 'async_trait,
fn update_by_wrapper<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 mut self,
table: &'life1 T,
w: &'life2 Wrapper,
skips: &'life3 [Skip<'_>]
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDTable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: Send + 'async_trait,
update_by_wrapper skips: use &[Skip::Value(&serde_json::Value::Null), Skip::Column(“id”), Skip::Column(column)] will skip id column and null value param Read more
fn update_by_column<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
column: &'life1 str,
table: &'life2 T
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDTable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
fn update_by_column<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
column: &'life1 str,
table: &'life2 T
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDTable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
update database record by id update sql will be skip null value and id column Read more
fn update_batch_by_column<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
column: &'life1 str,
args: &'life2 [T]
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDTable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
fn update_batch_by_column<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
column: &'life1 str,
args: &'life2 [T]
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDTable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
remove batch database record by args
fetch database record by a wrapper
count database record by a wrapper
fn fetch_by_column<'life0, 'life1, 'life2, 'async_trait, T, C>(
&'life0 mut self,
column: &'life1 str,
value: &'life2 C
) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>> where
T: CRUDTable + DeserializeOwned,
C: Serialize + Send + Sync,
T: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
fn fetch_by_column<'life0, 'life1, 'life2, 'async_trait, T, C>(
&'life0 mut self,
column: &'life1 str,
value: &'life2 C
) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>> where
T: CRUDTable + DeserializeOwned,
C: Serialize + Send + Sync,
T: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
fetch database record by value
fetch database record list by a wrapper
fetch database record list for all
fn fetch_list_by_column<'life0, 'life1, 'life2, 'async_trait, T, C>(
&'life0 mut self,
column: &'life1 str,
column_values: &'life2 [C]
) -> Pin<Box<dyn Future<Output = Result<Vec<T>>> + Send + 'async_trait>> where
T: CRUDTable + DeserializeOwned,
C: Serialize + Send + Sync,
T: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
fn fetch_list_by_column<'life0, 'life1, 'life2, 'async_trait, T, C>(
&'life0 mut self,
column: &'life1 str,
column_values: &'life2 [C]
) -> Pin<Box<dyn Future<Output = Result<Vec<T>>> + Send + 'async_trait>> where
T: CRUDTable + DeserializeOwned,
C: Serialize + Send + Sync,
T: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
fetch database record list by a id array
fn fetch_page_by_wrapper<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
w: &'life1 Wrapper,
page: &'life2 dyn IPageRequest
) -> Pin<Box<dyn Future<Output = Result<Page<T>>> + Send + 'async_trait>> where
T: CRUDTable + DeserializeOwned,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
fn fetch_page_by_wrapper<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
w: &'life1 Wrapper,
page: &'life2 dyn IPageRequest
) -> Pin<Box<dyn Future<Output = Result<Page<T>>> + Send + 'async_trait>> where
T: CRUDTable + DeserializeOwned,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + 'async_trait,
fetch page database record list by a wrapper
fn fetch_page<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 mut self,
sql: &'life1 str,
args: &'life2 Vec<Value>,
page_request: &'life3 dyn IPageRequest
) -> Pin<Box<dyn Future<Output = Result<Page<T>>> + Send + 'async_trait>> where
T: DeserializeOwned + Serialize + Send + Sync,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: Send + 'async_trait,
fn fetch_page<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 mut self,
sql: &'life1 str,
args: &'life2 Vec<Value>,
page_request: &'life3 dyn IPageRequest
) -> Pin<Box<dyn Future<Output = Result<Page<T>>> + Send + 'async_trait>> where
T: DeserializeOwned + Serialize + Send + Sync,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: Send + 'async_trait,
fetch page result(prepare sql)
fn exec<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
sql: &'life1 str,
args: &'life2 Vec<Value>
) -> Pin<Box<dyn Future<Output = Result<DBExecResult, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn fetch<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 mut self,
sql: &'life1 str,
args: &'life2 Vec<Value>
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + Send + 'async_trait>> where
T: DeserializeOwned,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Performs the conversion.