pub struct DbPool(/* private fields */);Expand description
Newtype around sea_orm::DatabaseConnection.
Registered as a managed service via app.managed_service(db) (which also
handles graceful pool shutdown) and extracted in handlers via the Db
extractor.
Implementations§
Source§impl DbPool
impl DbPool
Sourcepub fn connection(&self) -> &DatabaseConnection
pub fn connection(&self) -> &DatabaseConnection
Access the underlying SeaORM connection.
Methods from Deref<Target = DatabaseConnection>§
Sourcepub fn get_database_backend(&self) -> DatabaseBackend
pub fn get_database_backend(&self) -> DatabaseBackend
Sourcepub fn get_schema_builder(&self) -> SchemaBuilder
pub fn get_schema_builder(&self) -> SchemaBuilder
Creates a SchemaBuilder for this backend
Sourcepub async fn ping(&self) -> Result<(), DbErr>
pub async fn ping(&self) -> Result<(), DbErr>
Checks if a connection to the database is still valid.
Sourcepub async fn close_by_ref(&self) -> Result<(), DbErr>
pub async fn close_by_ref(&self) -> Result<(), DbErr>
Explicitly close the database connection
Sourcepub fn get_sqlite_connection_pool(&self) -> &Pool<Sqlite>
pub fn get_sqlite_connection_pool(&self) -> &Pool<Sqlite>
Trait Implementations§
Source§impl GracefulShutdown for DbPool
impl GracefulShutdown for DbPool
Source§fn graceful_shutdown(&self) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
fn graceful_shutdown(&self) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
Perform shutdown work (drain queues, close connections, etc.).
Source§fn shutdown_phase(&self) -> ShutdownPhase
fn shutdown_phase(&self) -> ShutdownPhase
Which phase this service shuts down in. Defaults to
Close.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