pub fn array_remove<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue, a, e>(
a: a,
e: e,
) -> array_remove<Arr, T, a, e>where
a: AsExpression<Arr>,
e: AsExpression<T>,
Available on crate feature
postgres_backend
only.Expand description
Removes all elements equal to the given value from the array
ยงExample
let ints = diesel::select(array_remove::<Array<_>, Integer, _, _>(vec![1, 2, 3, 2], 2))
.get_result::<Vec<i32>>(connection)?;
assert_eq!(vec![1, 3], ints);
let ints = diesel::select(array_remove::<Array<_>, Nullable<Integer>, _, _>(vec![None, Some(1), Some(2), None, Some(4)], None::<i32>))
.get_result::<Vec<Option<i32>>>(connection)?;
assert_eq!(vec![Some(1), Some(2), Some(4)], ints);
let ints = diesel::select(array_remove::<Nullable<Array<_>>, Nullable<Integer>, _, _>(None::<Vec<i32>>, None::<i32>))
.get_result::<Option<Vec<Option<i32>>>>(connection)?;
assert_eq!(None, ints);