pub struct PgHelpers;Expand description
PostgreSQL-specific query helpers.
Implementations§
Source§impl PgHelpers
impl PgHelpers
Sourcepub async fn query_returning(pool: &PgPool, sql: &str) -> SqlxResult<Vec<PgRow>>
pub async fn query_returning(pool: &PgPool, sql: &str) -> SqlxResult<Vec<PgRow>>
Execute a query with RETURNING clause.
Sourcepub async fn upsert(
_pool: &PgPool,
table: &str,
columns: &[&str],
conflict_columns: &[&str],
update_columns: &[&str],
) -> SqlxResult<String>
pub async fn upsert( _pool: &PgPool, table: &str, columns: &[&str], conflict_columns: &[&str], update_columns: &[&str], ) -> SqlxResult<String>
Execute INSERT … ON CONFLICT (upsert).
Sourcepub fn array_literal<T: Display>(values: &[T]) -> String
pub fn array_literal<T: Display>(values: &[T]) -> String
Generate a PostgreSQL array literal.
Sourcepub fn json_path(column: &str, path: &[&str]) -> String
pub fn json_path(column: &str, path: &[&str]) -> String
Generate a PostgreSQL JSON/JSONB path expression.
Sourcepub async fn has_extension(pool: &PgPool, extension: &str) -> SqlxResult<bool>
pub async fn has_extension(pool: &PgPool, extension: &str) -> SqlxResult<bool>
Check if a PostgreSQL extension is available.
Sourcepub async fn version(pool: &PgPool) -> SqlxResult<String>
pub async fn version(pool: &PgPool) -> SqlxResult<String>
Get PostgreSQL version.
Auto Trait Implementations§
impl Freeze for PgHelpers
impl RefUnwindSafe for PgHelpers
impl Send for PgHelpers
impl Sync for PgHelpers
impl Unpin for PgHelpers
impl UnwindSafe for PgHelpers
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> 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