Class ArrayFunctions
java.lang.Object
com.couchbase.client.java.query.dsl.functions.ArrayFunctions
@Experimental @Public public class ArrayFunctions extends Object
DSL for N1QL functions in the Array category.
You can use array functions to evaluate arrays, perform computations on elements
in an array, and to return a new array based on a transformation.
- Since:
- 2.2
- Author:
- Simon Baslé
-
Method Summary
Modifier and Type Method Description static ExpressionarrayAppend(JsonArray array, Expression value)Returned expression results in new array with value appended.static ExpressionarrayAppend(Expression expression, Expression value)Returned expression results in new array with value appended.static ExpressionarrayAppend(String expression, Expression value)Returned expression results in new array with value appended.static ExpressionarrayAvg(JsonArray array)Returned expression results in arithmetic mean (average) of all the non-NULL number values in the array, or NULL if there are no such values.static ExpressionarrayAvg(Expression expression)Returned expression results in arithmetic mean (average) of all the non-NULL number values in the array, or NULL if there are no such values.static ExpressionarrayAvg(String expression)Returned expression results in arithmetic mean (average) of all the non-NULL number values in the array, or NULL if there are no such values.static ExpressionarrayConcat(JsonArray array1, JsonArray array2)Returned expression results in new array with the concatenation of the input arrays.static ExpressionarrayConcat(Expression expression1, Expression expression2)Returned expression results in new array with the concatenation of the input arrays.static ExpressionarrayConcat(String expression1, String expression2)Returned expression results in new array with the concatenation of the input arrays.static ExpressionarrayContains(JsonArray array, Expression value)Returned expression results in true if the array contains value.static ExpressionarrayContains(Expression expression, Expression value)Returned expression results in true if the array contains value.static ExpressionarrayContains(String expression, Expression value)Returned expression results in true if the array contains value.static ExpressionarrayCount(JsonArray array)Returned expression results in count of all the non-NULL values in the array, or zero if there are no such values.static ExpressionarrayCount(Expression expression)Returned expression results in count of all the non-NULL values in the array, or zero if there are no such values.static ExpressionarrayCount(String expression)Returned expression results in count of all the non-NULL values in the array, or zero if there are no such values.static ExpressionarrayDistinct(JsonArray array)Returned expression results in new array with distinct elements of input array.static ExpressionarrayDistinct(Expression expression)Returned expression results in new array with distinct elements of input array.static ExpressionarrayDistinct(String expression)Returned expression results in new array with distinct elements of input array.static ExpressionarrayIfNull(JsonArray array)Returned expression results in the first non-NULL value in the array, or NULL.static ExpressionarrayIfNull(Expression expression)Returned expression results in the first non-NULL value in the array, or NULL.static ExpressionarrayIfNull(String expression)Returned expression results in the first non-NULL value in the array, or NULL.static ExpressionarrayLength(JsonArray array)Returned expression results in the number of elements in the array.static ExpressionarrayLength(Expression expression)Returned expression results in the number of elements in the array.static ExpressionarrayLength(String expression)Returned expression results in the number of elements in the array.static ExpressionarrayMax(JsonArray array)Returned expression results in the largest non-NULL, non-MISSING array element, in N1QL collation order.static ExpressionarrayMax(Expression expression)Returned expression results in the largest non-NULL, non-MISSING array element, in N1QL collation order.static ExpressionarrayMax(String expression)Returned expression results in the largest non-NULL, non-MISSING array element, in N1QL collation order.static ExpressionarrayMin(JsonArray array)Returned expression results in the smallest non-NULL, non-MISSING array element, in N1QL collation order.static ExpressionarrayMin(Expression expression)Returned expression results in the smallest non-NULL, non-MISSING array element, in N1QL collation order.static ExpressionarrayMin(String expression)Returned expression results in the smallest non-NULL, non-MISSING array element, in N1QL collation order.static ExpressionarrayPosition(JsonArray array, Expression value)Returned expression results in the first position of value within the array, or -1.static ExpressionarrayPosition(Expression expression, Expression value)Returned expression results in the first position of value within the array, or -1.static ExpressionarrayPosition(String expression, Expression value)Returned expression results in the first position of value within the array, or -1.static ExpressionarrayPrepend(JsonArray array, Expression value)Returned expression results in the new array with value pre-pended.static ExpressionarrayPrepend(Expression expression, Expression value)Returned expression results in the new array with value pre-pended.static ExpressionarrayPrepend(String expression, Expression value)Returned expression results in the new array with value pre-pended.static ExpressionarrayPut(JsonArray array, Expression value)Returned expression results in new array with value appended, if value is not already present, otherwise the unmodified input array.static ExpressionarrayPut(Expression expression, Expression value)Returned expression results in new array with value appended, if value is not already present, otherwise the unmodified input array.static ExpressionarrayPut(String expression, Expression value)Returned expression results in new array with value appended, if value is not already present, otherwise the unmodified input array.static ExpressionarrayRange(long start, long end)Returned expression results in new array of numbers, from start until the largest number less than end.static ExpressionarrayRange(long start, long end, long step)Returned expression results in new array of numbers, from start until the largest number less than end.static ExpressionarrayRemove(JsonArray array, Expression value)Returned expression results in new array with all occurrences of value removed.static ExpressionarrayRemove(Expression expression, Expression value)Returned expression results in new array with all occurrences of value removed.static ExpressionarrayRemove(String expression, Expression value)Returned expression results in new array with all occurrences of value removed.static ExpressionarrayRepeat(boolean value, long n)Returned expression results in new array with value repeated n times.static ExpressionarrayRepeat(Expression value, long n)Returned expression results in new array with value repeated n times.static ExpressionarrayRepeat(Number value, long n)Returned expression results in new array with value repeated n times.static ExpressionarrayRepeat(String value, long n)Returned expression results in new array with the string "value" repeated n times.static ExpressionarrayReplace(JsonArray array, Expression value1, Expression value2)Returned expression results in new array with all occurrences of value1 replaced by value2.static ExpressionarrayReplace(JsonArray array, Expression value1, Expression value2, long n)Returned expression results in new array with at most n occurrences of value1 replaced with value2.static ExpressionarrayReplace(Expression expression, Expression value1, Expression value2)Returned expression results in new array with all occurrences of value1 replaced by value2.static ExpressionarrayReplace(Expression expression, Expression value1, Expression value2, long n)Returned expression results in new array with at most n occurrences of value1 replaced with value2.static ExpressionarrayReplace(String expression, Expression value1, Expression value2)Returned expression results in new array with all occurrences of value1 replaced by value2.static ExpressionarrayReplace(String expression, Expression value1, Expression value2, long n)Returned expression results in new array with at most n occurrences of value1 replaced with value2.static ExpressionarrayReverse(JsonArray array)Returned expression results in new array with all elements in reverse order.static ExpressionarrayReverse(Expression expression)Returned expression results in new array with all elements in reverse order.static ExpressionarrayReverse(String expression)Returned expression results in new array with all elements in reverse order.static ExpressionarraySort(JsonArray array)Returned expression results in new array with elements sorted in N1QL collation order.static ExpressionarraySort(Expression expression)Returned expression results in new array with elements sorted in N1QL collation order.static ExpressionarraySort(String expression)Returned expression results in new array with elements sorted in N1QL collation order.static ExpressionarraySum(JsonArray array)Returned expression results in the sum of all the non-NULL number values in the array, or zero if there are no such values.static ExpressionarraySum(Expression expression)Returned expression results in the sum of all the non-NULL number values in the array, or zero if there are no such values.static ExpressionarraySum(String expression)Returned expression results in the sum of all the non-NULL number values in the array, or zero if there are no such values.
-
Method Details
-
arrayAppend
Returned expression results in new array with value appended. -
arrayAppend
Returned expression results in new array with value appended. -
arrayAppend
Returned expression results in new array with value appended. -
arrayAvg
Returned expression results in arithmetic mean (average) of all the non-NULL number values in the array, or NULL if there are no such values. -
arrayAvg
Returned expression results in arithmetic mean (average) of all the non-NULL number values in the array, or NULL if there are no such values. -
arrayAvg
Returned expression results in arithmetic mean (average) of all the non-NULL number values in the array, or NULL if there are no such values. -
arrayConcat
Returned expression results in new array with the concatenation of the input arrays. -
arrayConcat
Returned expression results in new array with the concatenation of the input arrays. -
arrayConcat
Returned expression results in new array with the concatenation of the input arrays. -
arrayContains
Returned expression results in true if the array contains value. -
arrayContains
Returned expression results in true if the array contains value. -
arrayContains
Returned expression results in true if the array contains value. -
arrayCount
Returned expression results in count of all the non-NULL values in the array, or zero if there are no such values. -
arrayCount
Returned expression results in count of all the non-NULL values in the array, or zero if there are no such values. -
arrayCount
Returned expression results in count of all the non-NULL values in the array, or zero if there are no such values. -
arrayDistinct
Returned expression results in new array with distinct elements of input array. -
arrayDistinct
Returned expression results in new array with distinct elements of input array. -
arrayDistinct
Returned expression results in new array with distinct elements of input array. -
arrayIfNull
Returned expression results in the first non-NULL value in the array, or NULL. -
arrayIfNull
Returned expression results in the first non-NULL value in the array, or NULL. -
arrayIfNull
Returned expression results in the first non-NULL value in the array, or NULL. -
arrayLength
Returned expression results in the number of elements in the array. -
arrayLength
Returned expression results in the number of elements in the array. -
arrayLength
Returned expression results in the number of elements in the array. -
arrayMax
Returned expression results in the largest non-NULL, non-MISSING array element, in N1QL collation order. -
arrayMax
Returned expression results in the largest non-NULL, non-MISSING array element, in N1QL collation order. -
arrayMax
Returned expression results in the largest non-NULL, non-MISSING array element, in N1QL collation order. -
arrayMin
Returned expression results in the smallest non-NULL, non-MISSING array element, in N1QL collation order. -
arrayMin
Returned expression results in the smallest non-NULL, non-MISSING array element, in N1QL collation order. -
arrayMin
Returned expression results in the smallest non-NULL, non-MISSING array element, in N1QL collation order. -
arrayPosition
Returned expression results in the first position of value within the array, or -1. Array position is zero-based, i.e. the first position is 0. -
arrayPosition
Returned expression results in the first position of value within the array, or -1. Array position is zero-based, i.e. the first position is 0. -
arrayPosition
Returned expression results in the first position of value within the array, or -1. Array position is zero-based, i.e. the first position is 0. -
arrayPrepend
Returned expression results in the new array with value pre-pended. -
arrayPrepend
Returned expression results in the new array with value pre-pended. -
arrayPrepend
Returned expression results in the new array with value pre-pended. -
arrayPut
Returned expression results in new array with value appended, if value is not already present, otherwise the unmodified input array. -
arrayPut
Returned expression results in new array with value appended, if value is not already present, otherwise the unmodified input array. -
arrayPut
Returned expression results in new array with value appended, if value is not already present, otherwise the unmodified input array. -
arrayRange
Returned expression results in new array of numbers, from start until the largest number less than end. Successive numbers are incremented by step. If step is omitted, the default is 1. If step is negative, decrements until the smallest number greater than end. -
arrayRange
Returned expression results in new array of numbers, from start until the largest number less than end. Successive numbers are incremented by 1. -
arrayRemove
Returned expression results in new array with all occurrences of value removed. -
arrayRemove
Returned expression results in new array with all occurrences of value removed. -
arrayRemove
Returned expression results in new array with all occurrences of value removed. -
arrayRepeat
Returned expression results in new array with value repeated n times. -
arrayRepeat
Returned expression results in new array with the string "value" repeated n times. -
arrayRepeat
Returned expression results in new array with value repeated n times. -
arrayRepeat
Returned expression results in new array with value repeated n times. -
arrayReplace
Returned expression results in new array with all occurrences of value1 replaced by value2. -
arrayReplace
Returned expression results in new array with all occurrences of value1 replaced by value2. -
arrayReplace
Returned expression results in new array with all occurrences of value1 replaced by value2. -
arrayReplace
public static Expression arrayReplace(Expression expression, Expression value1, Expression value2, long n)Returned expression results in new array with at most n occurrences of value1 replaced with value2. -
arrayReplace
public static Expression arrayReplace(String expression, Expression value1, Expression value2, long n)Returned expression results in new array with at most n occurrences of value1 replaced with value2. -
arrayReplace
public static Expression arrayReplace(JsonArray array, Expression value1, Expression value2, long n)Returned expression results in new array with at most n occurrences of value1 replaced with value2. -
arrayReverse
Returned expression results in new array with all elements in reverse order. -
arrayReverse
Returned expression results in new array with all elements in reverse order. -
arrayReverse
Returned expression results in new array with all elements in reverse order. -
arraySort
Returned expression results in new array with elements sorted in N1QL collation order. -
arraySort
Returned expression results in new array with elements sorted in N1QL collation order. -
arraySort
Returned expression results in new array with elements sorted in N1QL collation order. -
arraySum
Returned expression results in the sum of all the non-NULL number values in the array, or zero if there are no such values. -
arraySum
Returned expression results in the sum of all the non-NULL number values in the array, or zero if there are no such values. -
arraySum
Returned expression results in the sum of all the non-NULL number values in the array, or zero if there are no such values.
-