[][src]Function diesel::pg::expression::dsl::array

pub fn array<ST, T>(elements: T) -> ArrayLiteral<T::Expression, ST> where
    T: AsExpressionList<ST>, 

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 = users.select(array((id, id * 2)))
let expected = vec![
    vec![1, 2],
    vec![2, 4],
assert_eq!(expected, ids);