Skip to main content

array_contained

Function array_contained 

Source
pub fn array_contained<'a, L, R>(
    left: L,
    right: R,
) -> SQLExpr<'a, PostgresValue<'a>, Bool, NonNull, Scalar>
where L: Expr<'a, PostgresValue<'a>>, R: ToSQL<'a, PostgresValue<'a>>,
Expand description

PostgreSQL <@ operator - array is contained by.

Returns true if the left array is contained by the right array (i.e., all elements of left are in right).

ยงExample

let tags = SQL::<PostgresValue>::raw("tags");
let condition = array_contained(tags, "rust");
assert!(condition.to_sql().sql().contains("<@"));
// Generates: tags <@ $1