ArrayExpression class abstract final Query Builder
Array expression.
Range predicates
A range predicate tests a Boolean condition over the elements of an array.
A predicate has a quantifier which determines the number of elements that
need to match the condition, for the predicate to evaluate to true
.
The ANY
quantifier requires at least one of the array elements to match
the condition.
The EVERY
quantifier requires all of of the array elements to match the
condition, or for the array to be empty.
The ANY AND EVERY
quantifier requires all of of the array elements to
match the condition, and for the array not to be empty.
Here is how to build a range predicate expression:
final expr = ArrayExpression
// To build a range predicate you start by selecting one the
// quantifiers and defining the variable to which the array elements
// will be assigned.
.any(ArrayExpression.variable('myVar'))
// Next, you specify the array expression to evaluate the range
// predicate against.
.in_(Expression.property('myArray'))
// And lastly, you specify the condition which is evaluated for each
// array element, which should reference the previously defined variable.
.satisfies(
ArrayExpression.variable('myVar').equalTo(Expression.value(true)),
);
In the condition given to satisfies
, you can use a variable expression
which specifies a property path, if the array contains nested collections:
final expr = ArrayExpression.variable('myVar.property')
.equalTo(Expression.value(true));
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
any(
VariableExpressionInterface variable) → ArrayExpressionIn -
Starts an
ANY
quantified range predicate and defines avariable
. -
anyAndEvery(
VariableExpressionInterface variable) → ArrayExpressionIn -
Starts an
ANY AND EVERY
quantified range predicate and defines avariable
. -
every(
VariableExpressionInterface variable) → ArrayExpressionIn -
Starts an
EVERY
quantified range predicate and defines avariable
. -
variable(
String propertyPath) → VariableExpressionInterface - Creates a variable expression that is a placeholder for an element in an array.