pub enum DBPool {
None,
Mysql(Pool<MySql>, Arc<Box<dyn DataDecoder>>),
Postgres(Pool<Postgres>, Arc<Box<dyn DataDecoder>>),
Sqlite(Pool<Sqlite>, Arc<Box<dyn DataDecoder>>),
Mssql(Pool<Mssql>, Arc<Box<dyn DataDecoder>>),
}
Variants§
None
Mysql(Pool<MySql>, Arc<Box<dyn DataDecoder>>)
Postgres(Pool<Postgres>, Arc<Box<dyn DataDecoder>>)
Sqlite(Pool<Sqlite>, Arc<Box<dyn DataDecoder>>)
Mssql(Pool<Mssql>, Arc<Box<dyn DataDecoder>>)
Implementations§
Source§impl DBPool
impl DBPool
pub fn driver_type(&self) -> DriverType
pub async fn new(driver: &str) -> Result<DBPool, Error>
pub async fn new_opt_str( driver: &str, opt: DBPoolOptions, ) -> Result<DBPool, Error>
pub async fn new_opt( driver: &DBConnectOption, opt: DBPoolOptions, ) -> Result<DBPool, Error>
pub fn make_query<'f, 's>(&'f self, sql: &'s str) -> Result<DBQuery<'s>, Error>
Sourcepub async fn acquire(&self) -> Result<DBPoolConn<'_>, Error>
pub async fn acquire(&self) -> Result<DBPoolConn<'_>, Error>
Retrieves a connection from the pool.
Waits for at most the configured connection timeout before returning an error.
Sourcepub fn try_acquire(&self) -> Result<Option<DBPoolConn<'_>>, Error>
pub fn try_acquire(&self) -> Result<Option<DBPoolConn<'_>>, Error>
Attempts to retrieve a connection from the pool if there is one available.
Returns None
immediately if there are no idle connections available in the pool.
pub async fn begin(&self) -> Result<DBTx<'_>, Error>
pub async fn close(&self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DBPool
impl !RefUnwindSafe for DBPool
impl Send for DBPool
impl Sync for DBPool
impl Unpin for DBPool
impl !UnwindSafe for DBPool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more