diesel::pg::expression::dsl

Function any

Source
pub fn any<ST, T>(vals: T) -> Any<T::Expression>
where T: AsArrayExpression<ST>,
๐Ÿ‘ŽDeprecated since 2.0.0: Use ExpressionMethods::eq_any instead
Available on crate feature with-deprecated and non-crate feature without-deprecated and crate feature postgres_backend only.
Expand description

Creates a PostgreSQL ANY expression.

As with most bare functions, this is not exported by default. You can import it specifically from diesel::pg::expression::dsl::any, or diesel::dsl::any.

ยงExample

let sean = (1, "Sean".to_string());
let jim = (3, "Jim".to_string());
let data = users.filter(name.eq(any(vec!["Sean", "Jim"])));
assert_eq!(Ok(vec![sean, jim]), data.load(connection));