Struct sqlx_models_orm::Db
source · [−]Fields
pool: PgPool
transaction: PgTx
Implementations
sourceimpl 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> where
F: FnMut(PgRow) -> Result<T, Error> + Send,
T: Unpin + Send,
pub async fn fetch_all<'a, T, F>(&self, query: PgMap<'a, F>) -> Result<Vec<T>> where
F: FnMut(PgRow) -> Result<T, Error> + Send,
T: Unpin + Send,
pub async fn fetch_optional<'a, T, F>(
&self,
query: PgMap<'a, F>
) -> Result<Option<T>> where
F: FnMut(PgRow) -> Result<T, Error> + Send,
T: Unpin + Send,
pub async fn fetch_one_scalar<'a, T>(
&self,
query: PgQueryScalar<'a, T>
) -> Result<T> where
(T,): for<'r> FromRow<'r, PgRow>,
T: Unpin + Send,
pub async fn fetch_all_scalar<'a, T>(
&self,
query: PgQueryScalar<'a, T>
) -> Result<Vec<T>> where
(T,): for<'r> FromRow<'r, PgRow>,
T: Unpin + Send,
pub async fn fetch_optional_scalar<'a, T>(
&self,
query: PgQueryScalar<'a, T>
) -> Result<Option<T>> where
(T,): for<'r> FromRow<'r, PgRow>,
T: Unpin + Send,
pub async fn commit(&self) -> Result<()>
Trait Implementations
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more