Function diesel::pg::expression::dsl::array

source ·
pub fn array<ST, T>(elements: T) -> ArrayLiteral<T::Expression, ST>where
    T: AsExpressionList<ST>,
Available on crate feature postgres_backend only.
Expand description

Creates an ARRAY[...] expression.

The argument should be a tuple of expressions which can be represented by the same SQL type.


let ints = diesel::select(array::<Integer, _>((1, 2)))
assert_eq!(vec![1, 2], ints);

let ids =, id * 2)))
let expected = vec![
    vec![1, 2],
    vec![2, 4],
assert_eq!(expected, ids);