pub struct Rbatis {
pub pool: Arc<OnceCell<Pool>>,
pub sql_intercepts: Arc<Vec<Box<dyn SqlIntercept>>>,
pub log_plugin: Arc<Box<dyn LogPlugin>>,
}
Expand description
rbatis engine
Fields
pool: Arc<OnceCell<Pool>>
sql_intercepts: Arc<Vec<Box<dyn SqlIntercept>>>
log_plugin: Arc<Box<dyn LogPlugin>>
Implementations
sourceimpl Rbatis
impl Rbatis
sourcepub fn new_with_opt(option: RbatisOption) -> Self
pub fn new_with_opt(option: RbatisOption) -> Self
new Rbatis from Option
sourcepub async fn link<Driver: Driver + 'static>(
&self,
driver: Driver,
url: &str
) -> Result<(), Error>
pub async fn link<Driver: Driver + 'static>(
&self,
driver: Driver,
url: &str
) -> Result<(), Error>
link pool
sourcepub async fn link_builder<Driver: Driver + 'static>(
&self,
builder: Builder<ManagerPorxy>,
driver: Driver,
url: &str
) -> Result<(), Error>
pub async fn link_builder<Driver: Driver + 'static>(
&self,
builder: Builder<ManagerPorxy>,
driver: Driver,
url: &str
) -> Result<(), Error>
link pool
sourcepub async fn link_opt<Driver: Driver + 'static, ConnectOptions: ConnectOptions>(
&self,
driver: Driver,
options: ConnectOptions
) -> Result<(), Error>
pub async fn link_opt<Driver: Driver + 'static, ConnectOptions: ConnectOptions>(
&self,
driver: Driver,
options: ConnectOptions
) -> Result<(), Error>
link pool by DBPoolOptions for example:
sourcepub fn set_log_plugin(&mut self, arg: impl LogPlugin + 'static)
pub fn set_log_plugin(&mut self, arg: impl LogPlugin + 'static)
set_log_plugin
sourcepub fn set_sql_intercepts(&mut self, arg: Vec<Box<dyn SqlIntercept>>)
pub fn set_sql_intercepts(&mut self, arg: Vec<Box<dyn SqlIntercept>>)
set_sql_intercepts for many
sourcepub fn get_pool(&self) -> Result<&Pool, Error>
pub fn get_pool(&self) -> Result<&Pool, Error>
get conn pool
can set option for example:
let rbatis = rbatis::Rbatis::new();
// rbatis.link(**).await;
// rbatis.get_pool().unwrap().set_max_open_conns()
sourcepub fn driver_type(&self) -> Result<&str, Error>
pub fn driver_type(&self) -> Result<&str, Error>
get driver type
sourcepub async fn acquire(&self) -> Result<RBatisConnExecutor, Error>
pub async fn acquire(&self) -> Result<RBatisConnExecutor, Error>
get an DataBase Connection used for the next step
sourcepub async fn acquire_begin(&self) -> Result<RBatisTxExecutor, Error>
pub async fn acquire_begin(&self) -> Result<RBatisTxExecutor, Error>
get an DataBase Connection,and call begin method,used for the next step
sourcepub fn is_debug_mode(&self) -> bool
pub fn is_debug_mode(&self) -> bool
is debug mode
sourceimpl Rbatis
impl Rbatis
sourcepub async fn fetch_decode<T>(
&self,
sql: &str,
args: Vec<Value>
) -> Result<T, Error> where
T: DeserializeOwned,
pub async fn fetch_decode<T>(
&self,
sql: &str,
args: Vec<Value>
) -> Result<T, Error> where
T: DeserializeOwned,
fetch and decode
Trait Implementations
sourceimpl<'impl0> Executor for &'impl0 Rbatis
impl<'impl0> Executor for &'impl0 Rbatis
fn exec<'life0, 'life1, 'async_trait>(
&'life0 mut self,
sql: &'life1 str,
args: Vec<Value>
) -> Pin<Box<dyn Future<Output = Result<ExecResult, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn fetch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
sql: &'life1 str,
args: Vec<Value>
) -> Pin<Box<dyn Future<Output = Result<Value, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
sourceimpl Executor for Rbatis
impl Executor for Rbatis
fn exec<'life0, 'life1, 'async_trait>(
&'life0 mut self,
sql: &'life1 str,
args: Vec<Value>
) -> Pin<Box<dyn Future<Output = Result<ExecResult, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn fetch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
sql: &'life1 str,
args: Vec<Value>
) -> Pin<Box<dyn Future<Output = Result<Value, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
sourceimpl RbatisRef for &Rbatis
impl RbatisRef for &Rbatis
fn get_rbatis(&self) -> &Rbatis
fn driver_type(&self) -> Result<&str>
sourceimpl RbatisRef for Rbatis
impl RbatisRef for Rbatis
fn get_rbatis(&self) -> &Rbatis
fn driver_type(&self) -> Result<&str>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more