pub enum DbPool {
Sqlite(SqlitePool),
Postgres(PgPool),
}Expand description
A database connection pool — either SQLite or PostgreSQL.
DbPool is the primary database handle threaded through atrg’s
AppState. It is cheaply
cloneable (the underlying sqlx pools are themselves Arc-based).
Variants§
Sqlite(SqlitePool)
A SQLite connection pool. Available when the sqlite cargo feature
is enabled (the default).
Postgres(PgPool)
A PostgreSQL connection pool. Available when the postgres cargo
feature is enabled.
Implementations§
Source§impl DbPool
impl DbPool
Sourcepub fn as_sqlite(&self) -> Option<&SqlitePool>
pub fn as_sqlite(&self) -> Option<&SqlitePool>
Borrow the inner SQLite pool, if any.
Sourcepub fn as_postgres(&self) -> Option<&PgPool>
pub fn as_postgres(&self) -> Option<&PgPool>
Borrow the inner PostgreSQL pool, if any.
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 UnsafeUnpin 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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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