diesel::pg::expression::dsl

Function array_cat

source
pub fn array_cat<Arr: ArrayOrNullableArray + SingleValue, a, b>(
    a: a,
    b: b,
) -> array_cat<Arr, a, b>
where a: AsExpression<Arr>, b: AsExpression<Arr>,
Available on crate feature postgres_backend only.
Expand description

Concatenates two arrays

ยงExample

let result = diesel::select(array_cat::<Array<Integer>, _, _>(vec![1, 2], vec![3, 4]))
    .get_result::<Vec<i32>>(connection)?;
assert_eq!(vec![1, 2, 3, 4], result);

let nullable_result = diesel::select(array_cat::<Nullable<Array<Integer>>, _, _>(
    None::<Vec<i32>>,
    None::<Vec<i32>>
)).get_result::<Option<Vec<i32>>>(connection)?;
assert_eq!(None, nullable_result);