Documentation ¶
Overview ¶
Package set Set expressions performs set operation on arrays, treating arrays as sets. Set expressions ignores the duplicate entries in each input array and the order of the elements. If the set operation returns a set, the operation filters out duplicates in the result to output an array that contains only unique entries. The order of the elements in the output array is unspecified. If a set contains a nested array element, the set expression does not descend into the nested array but evaluates the array at top-level.
Index ¶
- func AllElementsTrue[T expression.ArrayExpression](n T) setOperator
- func AnyElementTrue[T expression.ArrayExpression](n T) setOperator
- func SetDifference[T expression.ArrayExpression](e1, e2 T) setOperator
- func SetEquals[T expression.ArrayExpression](es ...T) setOperator
- func SetIntersection[T expression.ArrayExpression](as ...T) setOperator
- func SetIsSubset[T expression.ArrayExpression](e1, e2 T) setOperator
- func SetUnion[T expression.ArrayExpression](as ...T) setOperator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllElementsTrue ¶
func AllElementsTrue[T expression.ArrayExpression](n T) setOperator
AllElementsTrue Evaluates an array as a set and returns true if no element in the array is false. Otherwise, returns false. An empty array returns true. $allElementsTrue has the following syntax: { $allElementsTrue: [ <expression> ] } The <expression> itself must resolve to an array, separate from the outer array that denotes the argument list
func AnyElementTrue ¶
func AnyElementTrue[T expression.ArrayExpression](n T) setOperator
AnyElementTrue Evaluates an array as a set and returns true if any of the elements are true and false otherwise. An empty array returns false. $anyElementTrue has the following syntax: { $anyElementTrue: [ <expression> ] } The <expression> itself must resolve to an array, separate from the outer array that denotes the argument list.
func SetDifference ¶
func SetDifference[T expression.ArrayExpression](e1, e2 T) setOperator
SetDifference Takes two sets and returns an array containing the elements that only exist in the first set; i.e. performs a relative complement of the second set relative to the first. $setDifference has the following syntax: { $setDifference: [ <expression1>, <expression2> ] } The arguments can be any valid expression as long as they each resolve to an array
func SetEquals ¶
func SetEquals[T expression.ArrayExpression](es ...T) setOperator
SetEquals Compares two or more arrays and returns true if they have the same distinct elements and false otherwise. $setEquals has the following syntax: { $setEquals: [ <expression1>, <expression2>, ... ] } The arguments can be any valid expression as long as they each resolve to an array.
func SetIntersection ¶
func SetIntersection[T expression.ArrayExpression](as ...T) setOperator
SetIntersection Takes two or more arrays and returns an array that contains the elements that appear in every input array. $setIntersection has the following syntax: { $setIntersection: [ <array1>, <array2>, ... ] } The arguments can be any valid expression as long as they each resolve to an array
func SetIsSubset ¶
func SetIsSubset[T expression.ArrayExpression](e1, e2 T) setOperator
SetIsSubset Takes two arrays and returns true when the first array is a subset of the second, including when the first array equals the second array, and false otherwise. $setIsSubset has the following syntax: { $setIsSubset: [ <expression1>, <expression2> ] } The arguments can be any valid expression as long as they each resolve to an array
func SetUnion ¶
func SetUnion[T expression.ArrayExpression](as ...T) setOperator
SetUnion Takes two or more arrays and returns an array containing the elements that appear in any input array. $setUnion has the following syntax: { $setUnion: [ <expression1>, <expression2>, ... ] } The arguments can be any valid expression as long as they each resolve to an array.
Types ¶
This section is empty.