pub struct DB { /* private fields */ }Expand description
PostgreSQL database connection wrapper.
Manages connection pool and provides access to sqlx and SeaORM connections.
Implementations§
Source§impl DB
impl DB
Sourcepub async fn new(app_name: &str, cfg: &Config) -> Result<Self>
pub async fn new(app_name: &str, cfg: &Config) -> Result<Self>
Creates a new PostgreSQL database connection with the given config.
Sourcepub async fn new_root(app_name: &str, cfg: &Config) -> Result<Self>
pub async fn new_root(app_name: &str, cfg: &Config) -> Result<Self>
Creates a new PostgreSQL database connection with root credentials.
Sourcepub fn database_connection(&self) -> DatabaseConnection
pub fn database_connection(&self) -> DatabaseConnection
Returns a SeaORM database connection.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DB
impl !RefUnwindSafe for DB
impl Send for DB
impl Sync for DB
impl Unpin for DB
impl UnsafeUnpin for DB
impl !UnwindSafe for DB
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