Struct sqlx_models_orm::Db
source · pub struct Db {
pub pool: PgPool,
pub transaction: PgTx,
}Fields§
§pool: PgPool§transaction: PgTxImplementations§
source§impl Db
impl Db
pub async fn connect(connection_string: &str) -> Result<Self>
pub async fn transaction(&self) -> Result<Self>
pub async fn execute<'a>(&self, query: PgQuery<'a>) -> Result<PgQueryResult>
pub async fn fetch_one<'a, T, F>(&self, query: PgMap<'a, F>) -> Result<T>
pub async fn fetch_all<'a, T, F>(&self, query: PgMap<'a, F>) -> Result<Vec<T>>
pub async fn fetch_optional<'a, T, F>( &self, query: PgMap<'a, F>, ) -> Result<Option<T>>
pub async fn fetch_one_scalar<'a, T>( &self, query: PgQueryScalar<'a, T>, ) -> Result<T>
pub async fn fetch_all_scalar<'a, T>( &self, query: PgQueryScalar<'a, T>, ) -> Result<Vec<T>>
pub async fn fetch_optional_scalar<'a, T>( &self, query: PgQueryScalar<'a, T>, ) -> Result<Option<T>>
pub async fn commit(&self) -> Result<()>
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 !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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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