[−][src]Struct rbatis::rbatis::Rbatis
rbatis engine
Fields
pool: OnceCell<DBPool>
engine: RbatisEngine
mapper_node_map: HashMap<String, HashMap<String, NodeType>>
tx_context: DashMap<String, DBTx>
page_plugin: Box<dyn PagePlugin>
sql_intercepts: Vec<Box<dyn SqlIntercept>>
logic_plugin: Option<Box<dyn LogicDelete>>
Implementations
impl Rbatis
[src]
pub fn new() -> Self
[src]
pub fn new_wrapper(&self) -> Wrapper
[src]
try return an new wrapper,if not call the link() method,it will be panic!
pub fn check(&self)
[src]
pub async fn link<'_, '_>(&'_ self, url: &'_ str) -> Result<(), Error>
[src]
link pool
pub async fn link_opt<'_, '_, '_>(
&'_ self,
url: &'_ str,
opt: &'_ PoolOptions
) -> Result<(), Error>
[src]
&'_ self,
url: &'_ str,
opt: &'_ PoolOptions
) -> Result<(), Error>
link pool by options for example:
pub fn load_xml(&mut self, mapper_name: &str, data: &str) -> Result<(), Error>
[src]
load xml data into rbatis
pub fn get_pool(&self) -> Result<&DBPool, Error>
[src]
get conn pool
pub fn driver_type(&self) -> Result<DriverType, Error>
[src]
get driver type
pub async fn begin<'_, '_>(&'_ self, new_tx_id: &'_ str) -> Result<u64, Error>
[src]
begin tx,for new conn
pub async fn begin_with_conn<'_, '_>(
&'_ self,
new_tx_id: &'_ str,
db_conn: DBPoolConn
) -> Result<u64, Error>
[src]
&'_ self,
new_tx_id: &'_ str,
db_conn: DBPoolConn
) -> Result<u64, Error>
begin tx,with an exist conn
pub async fn commit<'_, '_>(
&'_ self,
tx_id: &'_ str
) -> Result<DBPoolConn, Error>
[src]
&'_ self,
tx_id: &'_ str
) -> Result<DBPoolConn, Error>
commit tx,and return conn
pub async fn rollback<'_, '_>(
&'_ self,
tx_id: &'_ str
) -> Result<DBPoolConn, Error>
[src]
&'_ self,
tx_id: &'_ str
) -> Result<DBPoolConn, Error>
rollback tx,and return conn
pub async fn fetch<T, '_, '_, '_>(
&'_ self,
tx_id: &'_ str,
sql: &'_ str
) -> Result<T, Error> where
T: DeserializeOwned,
[src]
&'_ self,
tx_id: &'_ str,
sql: &'_ str
) -> Result<T, Error> where
T: DeserializeOwned,
fetch result(row sql)
pub async fn exec<'_, '_, '_>(
&'_ self,
tx_id: &'_ str,
sql: &'_ str
) -> Result<u64, Error>
[src]
&'_ self,
tx_id: &'_ str,
sql: &'_ str
) -> Result<u64, Error>
exec sql(row sql)
pub async fn fetch_prepare<T, '_, '_, '_, '_>(
&'_ self,
tx_id: &'_ str,
sql: &'_ str,
args: &'_ Vec<Value>
) -> Result<T, Error> where
T: DeserializeOwned,
[src]
&'_ self,
tx_id: &'_ str,
sql: &'_ str,
args: &'_ Vec<Value>
) -> Result<T, Error> where
T: DeserializeOwned,
fetch result(prepare sql)
pub async fn exec_prepare<'_, '_, '_, '_>(
&'_ self,
tx_id: &'_ str,
sql: &'_ str,
args: &'_ Vec<Value>
) -> Result<u64, Error>
[src]
&'_ self,
tx_id: &'_ str,
sql: &'_ str,
args: &'_ Vec<Value>
) -> Result<u64, Error>
exec sql(prepare sql)
pub async fn xml_fetch<T, Ser, '_, '_, '_, '_, '_>(
&'_ self,
tx_id: &'_ str,
mapper: &'_ str,
method: &'_ str,
arg: &'_ Ser
) -> Result<T, Error> where
T: DeserializeOwned,
Ser: Serialize + Send + Sync,
[src]
&'_ self,
tx_id: &'_ str,
mapper: &'_ str,
method: &'_ str,
arg: &'_ Ser
) -> Result<T, Error> where
T: DeserializeOwned,
Ser: Serialize + Send + Sync,
fetch result(prepare sql)
pub async fn xml_exec<Ser, '_, '_, '_, '_, '_>(
&'_ self,
tx_id: &'_ str,
mapper: &'_ str,
method: &'_ str,
arg: &'_ Ser
) -> Result<u64, Error> where
Ser: Serialize + Send + Sync,
[src]
&'_ self,
tx_id: &'_ str,
mapper: &'_ str,
method: &'_ str,
arg: &'_ Ser
) -> Result<u64, Error> where
Ser: Serialize + Send + Sync,
exec sql(prepare sql)
pub async fn py_fetch<T, Ser, '_, '_, '_, '_>(
&'_ self,
tx_id: &'_ str,
py: &'_ str,
arg: &'_ Ser
) -> Result<T, Error> where
T: DeserializeOwned,
Ser: Serialize + Send + Sync,
[src]
&'_ self,
tx_id: &'_ str,
py: &'_ str,
arg: &'_ Ser
) -> Result<T, Error> where
T: DeserializeOwned,
Ser: Serialize + Send + Sync,
fetch query result(prepare sql) for example:
let py = r#" SELECT * FROM biz_activity WHERE delete_flag = #{delete_flag} if name != null: AND name like #{name+'%'} if ids != null: AND id in ( trim ',': for item in ids: #{item}, )"#; let data: serde_json::Value = rb.py_fetch("", py, &json!({ "delete_flag": 1 })).await.unwrap();
pub async fn py_exec<Ser, '_, '_, '_, '_>(
&'_ self,
tx_id: &'_ str,
py: &'_ str,
arg: &'_ Ser
) -> Result<u64, Error> where
Ser: Serialize + Send + Sync,
[src]
&'_ self,
tx_id: &'_ str,
py: &'_ str,
arg: &'_ Ser
) -> Result<u64, Error> where
Ser: Serialize + Send + Sync,
exec sql(prepare sql) for example:
let py = r#" SELECT * FROM biz_activity WHERE delete_flag = #{delete_flag} if name != null: AND name like #{name+'%'} if ids != null: AND id in ( trim ',': for item in ids: #{item}, )"#; let data: u64 = rb.py_exec("", py, &json!({ "delete_flag": 1 })).await.unwrap();
pub async fn fetch_page<T, '_, '_, '_, '_, '_>(
&'_ self,
tx_id: &'_ str,
sql: &'_ str,
args: &'_ Vec<Value>,
page_request: &'_ dyn IPageRequest
) -> Result<Page<T>, Error> where
T: DeserializeOwned + Serialize + Send + Sync,
[src]
&'_ self,
tx_id: &'_ str,
sql: &'_ str,
args: &'_ Vec<Value>,
page_request: &'_ dyn IPageRequest
) -> Result<Page<T>, Error> where
T: DeserializeOwned + Serialize + Send + Sync,
fetch page result(prepare sql)
pub async fn xml_fetch_page<T, Ser, '_, '_, '_, '_, '_, '_>(
&'_ self,
tx_id: &'_ str,
mapper: &'_ str,
method: &'_ str,
arg: &'_ Ser,
page: &'_ dyn IPageRequest
) -> Result<Page<T>, Error> where
T: DeserializeOwned + Serialize + Send + Sync,
Ser: Serialize + Send + Sync,
[src]
&'_ self,
tx_id: &'_ str,
mapper: &'_ str,
method: &'_ str,
arg: &'_ Ser,
page: &'_ dyn IPageRequest
) -> Result<Page<T>, Error> where
T: DeserializeOwned + Serialize + Send + Sync,
Ser: Serialize + Send + Sync,
fetch result(prepare sql)
pub async fn py_fetch_page<T, Ser, '_, '_, '_, '_, '_>(
&'_ self,
tx_id: &'_ str,
py: &'_ str,
arg: &'_ Ser,
page: &'_ dyn IPageRequest
) -> Result<Page<T>, Error> where
T: DeserializeOwned + Serialize + Send + Sync,
Ser: Serialize + Send + Sync,
[src]
&'_ self,
tx_id: &'_ str,
py: &'_ str,
arg: &'_ Ser,
page: &'_ dyn IPageRequest
) -> Result<Page<T>, Error> where
T: DeserializeOwned + Serialize + Send + Sync,
Ser: Serialize + Send + Sync,
fetch result(prepare sql)
Trait Implementations
impl CRUD for Rbatis
[src]
fn save<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
tx_id: &'life1 str,
entity: &'life2 T
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
tx_id: &'life1 str,
entity: &'life2 T
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
save one entity to database
fn save_batch<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
tx_id: &'life1 str,
args: &'life2 [T]
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
tx_id: &'life1 str,
args: &'life2 [T]
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
save batch makes many value into only one sql. make sure your data not to long!
for Example: rb.save_batch(&vec![activity]); [rbatis] Exec ==> INSERT INTO biz_activity (id,name,version) VALUES ( ? , ? , ?),( ? , ? , ?)
fn remove_by_wrapper<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
tx_id: &'life1 str,
w: &'life2 Wrapper
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
tx_id: &'life1 str,
w: &'life2 Wrapper
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn remove_by_id<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
tx_id: &'life1 str,
id: &'life2 T::IdType
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
tx_id: &'life1 str,
id: &'life2 T::IdType
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn remove_batch_by_id<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
tx_id: &'life1 str,
ids: &'life2 [T::IdType]
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
tx_id: &'life1 str,
ids: &'life2 [T::IdType]
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
remove batch id
for Example :
rb.remove_batch_by_id::
fn update_by_wrapper<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 self,
tx_id: &'life1 str,
arg: &'life2 T,
w: &'life3 Wrapper,
update_null_value: bool
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
tx_id: &'life1 str,
arg: &'life2 T,
w: &'life3 Wrapper,
update_null_value: bool
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
update arg by wrapper
fn update_by_id<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
tx_id: &'life1 str,
arg: &'life2 T
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
tx_id: &'life1 str,
arg: &'life2 T
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn update_batch_by_id<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
tx_id: &'life1 str,
args: &'life2 [T]
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
tx_id: &'life1 str,
args: &'life2 [T]
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn fetch_by_wrapper<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
tx_id: &'life1 str,
w: &'life2 Wrapper
) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
tx_id: &'life1 str,
w: &'life2 Wrapper
) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn fetch_by_id<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
tx_id: &'life1 str,
id: &'life2 T::IdType
) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
tx_id: &'life1 str,
id: &'life2 T::IdType
) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn list_by_wrapper<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
tx_id: &'life1 str,
w: &'life2 Wrapper
) -> Pin<Box<dyn Future<Output = Result<Vec<T>>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
tx_id: &'life1 str,
w: &'life2 Wrapper
) -> Pin<Box<dyn Future<Output = Result<Vec<T>>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn list<'life0, 'life1, 'async_trait, T>(
&'life0 self,
tx_id: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Vec<T>>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
tx_id: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Vec<T>>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn list_by_ids<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
tx_id: &'life1 str,
ids: &'life2 [T::IdType]
) -> Pin<Box<dyn Future<Output = Result<Vec<T>>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
tx_id: &'life1 str,
ids: &'life2 [T::IdType]
) -> Pin<Box<dyn Future<Output = Result<Vec<T>>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn fetch_page_by_wrapper<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 self,
tx_id: &'life1 str,
w: &'life2 Wrapper,
page: &'life3 dyn IPageRequest
) -> Pin<Box<dyn Future<Output = Result<Page<T>>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
tx_id: &'life1 str,
w: &'life2 Wrapper,
page: &'life3 dyn IPageRequest
) -> Pin<Box<dyn Future<Output = Result<Page<T>>> + Send + 'async_trait>> where
T: CRUDEnable,
T: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
impl<'r> Default for Rbatis
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Rbatis
impl Send for Rbatis
impl Sync for Rbatis
impl Unpin for Rbatis
impl !UnwindSafe for Rbatis
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,