Trait rbatis::crud::CRUDMut[][src]

pub trait CRUDMut: ExecutorMut {
Show 19 methods fn save_by_wrapper<'life0, 'life1, 'life2, 'async_trait, T>(
        &'life0 mut self,
        table: &'life1 T,
        w: Wrapper,
        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
, { ... }
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_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 remove_by_wrapper<'life0, 'async_trait, T>(
        &'life0 mut self,
        w: Wrapper
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
    where
        T: CRUDTable,
        T: 'async_trait,
        'life0: 'async_trait,
        Self: Send + 'async_trait
, { ... }
fn remove_by_column<'life0, 'life1, 'life2, 'async_trait, T, P>(
        &'life0 mut self,
        column: &'life1 str,
        value: &'life2 P
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
    where
        T: CRUDTable,
        P: Serialize + Send + Sync,
        T: 'async_trait,
        P: '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, P>(
        &'life0 mut self,
        column: &'life1 str,
        values: &'life2 [P]
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
    where
        T: CRUDTable,
        P: Serialize + Send + Sync,
        T: 'async_trait,
        P: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        Self: Send + 'async_trait
, { ... }
fn update_by_wrapper<'life0, 'life1, 'life2, 'async_trait, T>(
        &'life0 mut self,
        table: &'life1 T,
        w: Wrapper,
        skips: &'life2 [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,
        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
, { ... }
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 fetch_by_wrapper<'life0, 'async_trait, T>(
        &'life0 mut self,
        w: Wrapper
    ) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>
    where
        T: CRUDTable + DeserializeOwned,
        T: 'async_trait,
        'life0: 'async_trait,
        Self: Send + 'async_trait
, { ... }
fn fetch_count<'life0, 'async_trait, T>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
    where
        T: CRUDTable,
        T: 'async_trait,
        'life0: 'async_trait,
        Self: Send + 'async_trait
, { ... }
fn fetch_count_by_wrapper<'life0, 'async_trait, T>(
        &'life0 mut self,
        w: Wrapper
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
    where
        T: CRUDTable,
        T: 'async_trait,
        'life0: 'async_trait,
        Self: Send + 'async_trait
, { ... }
fn fetch_by_column<'life0, 'life1, 'life2, 'async_trait, T, P>(
        &'life0 mut self,
        column: &'life1 str,
        value: &'life2 P
    ) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>
    where
        T: CRUDTable + DeserializeOwned,
        P: Serialize + Send + Sync,
        T: 'async_trait,
        P: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        Self: Send + 'async_trait
, { ... }
fn fetch_list_by_wrapper<'life0, 'async_trait, T>(
        &'life0 mut self,
        w: Wrapper
    ) -> Pin<Box<dyn Future<Output = Result<Vec<T>>> + Send + 'async_trait>>
    where
        T: CRUDTable + DeserializeOwned,
        T: 'async_trait,
        'life0: 'async_trait,
        Self: Send + 'async_trait
, { ... }
fn fetch_list<'life0, 'async_trait, T>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<Vec<T>>> + Send + 'async_trait>>
    where
        T: CRUDTable + DeserializeOwned,
        T: 'async_trait,
        'life0: 'async_trait,
        Self: Send + 'async_trait
, { ... }
fn fetch_list_by_column<'life0, 'life1, 'life2, 'async_trait, T, P>(
        &'life0 mut self,
        column: &'life1 str,
        column_values: &'life2 [P]
    ) -> Pin<Box<dyn Future<Output = Result<Vec<T>>> + Send + 'async_trait>>
    where
        T: CRUDTable + DeserializeOwned,
        P: Serialize + Send + Sync,
        T: 'async_trait,
        P: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        Self: Send + 'async_trait
, { ... }
fn fetch_page_by_wrapper<'life0, 'life1, 'async_trait, T>(
        &'life0 mut self,
        w: Wrapper,
        page: &'life1 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,
        Self: Send + 'async_trait
, { ... }
fn fetch_page<'life0, 'life1, 'life2, 'async_trait, T>(
        &'life0 mut self,
        sql: &'life1 str,
        args: Vec<Bson>,
        page_request: &'life2 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,
        Self: Send + 'async_trait
, { ... }
}

Provided methods

save by wrapper

save one entity to database

save batch makes many value into only one sql. make sure your data do not too long!

for Example: rb.save_batch(“”,&Cec![activity]); [rbatis] Exec ==> insert into biz_activity (id,name,version) values ( ? , ? , ?),( ? , ? , ?)

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

for Example: rb.save_batch_slice(“”,&Cec![activity],0); [rbatis] Exec ==> insert into biz_activity (id,name,version) values ( ? , ? , ?),( ? , ? , ?)

remove database record by a wrapper

remove database record by id

remove batch id for Example : rb.remove_batch_by_column::(&[“1”.to_string(),“2”.to_string()]).await; [rbatis] Exec ==> delete from biz_activity where id IN ( ? , ? )

update_by_wrapper skips: use &[Skip::Value(&bson::Bson::Null), Skip::Column(“id”), Skip::Column(column)] will skip id column and null value param

update database record by id update sql will be skip null value and id column

remove batch database record by args

fetch database record by a wrapper

count database record

count database record by a wrapper

fetch database record by value

fetch database record list by a wrapper

fetch database record list for all

fetch database record list by a id array

fetch page database record list by a wrapper

fetch page result(prepare sql)

Implementors