pub enum MiddlewarePool {
Postgres(Pool<PgManager>),
Sqlite(Pool<SqliteManager>),
}Expand description
Connection pool for database access
This enum wraps the different connection pool types for the supported database engines.
Variants§
Postgres(Pool<PgManager>)
PostgreSQL connection pool
Sqlite(Pool<SqliteManager>)
SQLite connection pool
Implementations§
Source§impl MiddlewarePool
impl MiddlewarePool
Sourcepub async fn get_connection(
pool: &MiddlewarePool,
translate_placeholders: bool,
) -> Result<MiddlewarePoolConnection, SqlMiddlewareDbError>
pub async fn get_connection( pool: &MiddlewarePool, translate_placeholders: bool, ) -> Result<MiddlewarePoolConnection, SqlMiddlewareDbError>
Get a connection from the pool
§Errors
Returns SqlMiddlewareDbError::PoolErrorPostgres or SqlMiddlewareDbError::PoolErrorSqlite if the pool fails to provide a connection.
Source§impl MiddlewarePool
impl MiddlewarePool
Sourcepub async fn get(&self) -> Result<&MiddlewarePool, SqlMiddlewareDbError>
pub async fn get(&self) -> Result<&MiddlewarePool, SqlMiddlewareDbError>
Return a reference to self instead of cloning the entire pool
§Errors
This function currently never returns an error but maintains Result for API consistency.
Trait Implementations§
Source§impl Clone for MiddlewarePool
impl Clone for MiddlewarePool
Source§fn clone(&self) -> MiddlewarePool
fn clone(&self) -> MiddlewarePool
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MiddlewarePool
impl !RefUnwindSafe for MiddlewarePool
impl Send for MiddlewarePool
impl Sync for MiddlewarePool
impl Unpin for MiddlewarePool
impl !UnwindSafe for MiddlewarePool
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