pub struct PgArray<T>(pub Vec<T>);Expand description
Wrapper for passing a Vec<T> as a single PostgreSQL array parameter.
Without this wrapper, Vec<T> implements ToSQL by joining elements
with commas ($1, $2, $3), which is correct for IN (...) clauses
but wrong for array operators like @>, <@, and && which expect
a single array parameter.
§Example
let tags = SQL::<PostgresValue>::raw("tags");
// Correct: passes as a single array parameter
let condition = array_contains(tags, PgArray(vec!["rust", "python"]));Tuple Fields§
§0: Vec<T>Trait Implementations§
Source§impl<'a, T> ToSQL<'a, PostgresValue<'a>> for PgArray<T>
impl<'a, T> ToSQL<'a, PostgresValue<'a>> for PgArray<T>
Auto Trait Implementations§
impl<T> Freeze for PgArray<T>
impl<T> RefUnwindSafe for PgArray<T>where
T: RefUnwindSafe,
impl<T> Send for PgArray<T>where
T: Send,
impl<T> Sync for PgArray<T>where
T: Sync,
impl<T> Unpin for PgArray<T>where
T: Unpin,
impl<T> UnsafeUnpin for PgArray<T>
impl<T> UnwindSafe for PgArray<T>where
T: UnwindSafe,
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