pub trait ArrayExprExt<'a>: Expr<'a, PostgresValue<'a>> + Sized {
// Provided methods
fn array_contains<R>(
self,
other: R,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>
where R: ToSQL<'a, PostgresValue<'a>> { ... }
fn array_contained<R>(
self,
other: R,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>
where R: ToSQL<'a, PostgresValue<'a>> { ... }
fn array_overlaps<R>(
self,
other: R,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>
where R: ToSQL<'a, PostgresValue<'a>> { ... }
}Expand description
Extension trait providing method-based array operators for PostgreSQL expressions.
This trait provides .array_contains(), .array_contained(), and .array_overlaps()
methods on any expression type.
§Example
let tags = SQL::<PostgresValue>::raw("tags");
let condition = tags.array_contains("rust");
assert!(condition.to_sql().sql().contains("@>"));Provided Methods§
Sourcefn array_contains<R>(
self,
other: R,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>where
R: ToSQL<'a, PostgresValue<'a>>,
fn array_contains<R>(
self,
other: R,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>where
R: ToSQL<'a, PostgresValue<'a>>,
PostgreSQL @> operator - array contains.
Returns true if self contains all elements of the other array.
Sourcefn array_contained<R>(
self,
other: R,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>where
R: ToSQL<'a, PostgresValue<'a>>,
fn array_contained<R>(
self,
other: R,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>where
R: ToSQL<'a, PostgresValue<'a>>,
PostgreSQL <@ operator - array is contained by.
Returns true if self is contained by the other array.
Sourcefn array_overlaps<R>(
self,
other: R,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>where
R: ToSQL<'a, PostgresValue<'a>>,
fn array_overlaps<R>(
self,
other: R,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>where
R: ToSQL<'a, PostgresValue<'a>>,
PostgreSQL && operator - arrays overlap.
Returns true if self and the other array have any elements in common.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl<'a, E: Expr<'a, PostgresValue<'a>>> ArrayExprExt<'a> for E
Blanket implementation for all PostgreSQL Expr types.