pub struct ConnectionPool { /* private fields */ }Expand description
Wrapper around a SeaORM database connection.
Implementations§
Source§impl ConnectionPool
impl ConnectionPool
Sourcepub async fn connect(url: &str) -> Result<Self, ConnectionError>
pub async fn connect(url: &str) -> Result<Self, ConnectionError>
Establishes a database connection from a URL.
Sourcepub fn connect_sync(url: &str) -> Result<Self, ConnectionError>
pub fn connect_sync(url: &str) -> Result<Self, ConnectionError>
Synchronous wrapper for Self::connect.
Sourcepub async fn connect_with_options(
options: ConnectOptions,
) -> Result<Self, ConnectionError>
pub async fn connect_with_options( options: ConnectOptions, ) -> Result<Self, ConnectionError>
Establishes a database connection using explicit connection options.
Sourcepub fn connect_with_options_sync(
options: ConnectOptions,
) -> Result<Self, ConnectionError>
pub fn connect_with_options_sync( options: ConnectOptions, ) -> Result<Self, ConnectionError>
Synchronous wrapper for Self::connect_with_options.
Sourcepub fn connection(&self) -> &DatabaseConnection
pub fn connection(&self) -> &DatabaseConnection
Returns the underlying SeaORM connection.
Sourcepub async fn ping(&self) -> Result<(), ConnectionError>
pub async fn ping(&self) -> Result<(), ConnectionError>
Executes a simple query to confirm the connection is healthy.
Sourcepub fn ping_sync(&self) -> Result<(), ConnectionError>
pub fn ping_sync(&self) -> Result<(), ConnectionError>
Synchronous wrapper for Self::ping.
Sourcepub async fn close(self) -> Result<(), ConnectionError>
pub async fn close(self) -> Result<(), ConnectionError>
Closes the underlying database connection.
Sourcepub fn close_sync(self) -> Result<(), ConnectionError>
pub fn close_sync(self) -> Result<(), ConnectionError>
Synchronous wrapper for Self::close.
Trait Implementations§
Source§impl Clone for ConnectionPool
impl Clone for ConnectionPool
Source§fn clone(&self) -> ConnectionPool
fn clone(&self) -> ConnectionPool
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 ConnectionPool
impl !RefUnwindSafe for ConnectionPool
impl Send for ConnectionPool
impl Sync for ConnectionPool
impl Unpin for ConnectionPool
impl UnsafeUnpin for ConnectionPool
impl !UnwindSafe for ConnectionPool
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