Interface: FilterBuilder<TableInfo>
server.FilterBuilder
An interface for defining filters in queries.
FilterBuilder
has various methods that produce Expressions.
These expressions can be nested together along with constants to express
a filter predicate.
FilterBuilder
is used within filter to create query
filters.
Here are the available methods:
Comparisons | Error when l and r are not the same type. |
eq(l, r) | l === r |
neq(l, r) | l !== r |
lt(l, r) | l < r |
lte(l, r) | l <= r |
gt(l, r) | l > r |
gte(l, r) | l >= r |
Arithmetic | Error when l and r are not the same type. |
add(l, r) | l + r |
sub(l, r) | l - r |
mul(l, r) | l * r |
div(l, r) | l / r |
mod(l, r) | l % r |
neg(x) | -x |
Logic | Error if any param is not a bool . |
not(x) | !x |
and(a, b, ..., z) | a && b && ... && z |
or(a, b, ..., z) | a || b || ... || z |
Other | |
field(fieldPath) | Evaluates to the field at fieldPath . |
Type parameters
Name | Type |
---|---|
TableInfo | extends GenericTableInfo |
Methods
eq
▸ eq<T
>(l
, r
): Expression
<boolean
>
l === r
Type parameters
Name | Type |
---|---|
T | extends undefined | Value |
Parameters
Name | Type |
---|---|
l | ExpressionOrValue <T > |
r | ExpressionOrValue <T > |
Returns
Expression
<boolean
>
Defined in
neq
▸ neq<T
>(l
, r
): Expression
<boolean
>
l !== r
Type parameters
Name | Type |
---|---|
T | extends undefined | Value |
Parameters
Name | Type |
---|---|
l | ExpressionOrValue <T > |
r | ExpressionOrValue <T > |
Returns
Expression
<boolean
>
Defined in
lt
▸ lt<T
>(l
, r
): Expression
<boolean
>
l < r
Type parameters
Name | Type |
---|---|
T | extends Value |
Parameters
Name | Type |
---|---|
l | ExpressionOrValue <T > |
r | ExpressionOrValue <T > |
Returns
Expression
<boolean
>
Defined in
lte
▸ lte<T
>(l
, r
): Expression
<boolean
>
l <= r
Type parameters
Name | Type |
---|---|
T | extends Value |
Parameters
Name | Type |
---|---|
l | ExpressionOrValue <T > |
r | ExpressionOrValue <T > |
Returns
Expression
<boolean
>
Defined in
gt
▸ gt<T
>(l
, r
): Expression
<boolean
>
l > r
Type parameters
Name | Type |
---|---|
T | extends Value |
Parameters
Name | Type |
---|---|
l | ExpressionOrValue <T > |
r | ExpressionOrValue <T > |
Returns
Expression
<boolean
>
Defined in
gte
▸ gte<T
>(l
, r
): Expression
<boolean
>
l >= r
Type parameters
Name | Type |
---|---|
T | extends Value |
Parameters
Name | Type |
---|---|
l | ExpressionOrValue <T > |
r | ExpressionOrValue <T > |
Returns
Expression
<boolean
>
Defined in
add
▸ add<T
>(l
, r
): Expression
<T
>
l + r
Type parameters
Name | Type |
---|---|
T | extends NumericValue |
Parameters
Name | Type |
---|---|
l | ExpressionOrValue <T > |
r | ExpressionOrValue <T > |
Returns
Expression
<T
>
Defined in
sub
▸ sub<T
>(l
, r
): Expression
<T
>
l - r
Type parameters
Name | Type |
---|---|
T | extends NumericValue |
Parameters
Name | Type |
---|---|
l | ExpressionOrValue <T > |
r | ExpressionOrValue <T > |
Returns
Expression
<T
>
Defined in
mul
▸ mul<T
>(l
, r
): Expression
<T
>
l * r
Type parameters
Name | Type |
---|---|
T | extends NumericValue |
Parameters
Name | Type |
---|---|
l | ExpressionOrValue <T > |
r | ExpressionOrValue <T > |
Returns
Expression
<T
>
Defined in
div
▸ div<T
>(l
, r
): Expression
<T
>
l / r
Type parameters
Name | Type |
---|---|
T | extends NumericValue |
Parameters
Name | Type |
---|---|
l | ExpressionOrValue <T > |
r | ExpressionOrValue <T > |
Returns
Expression
<T
>
Defined in
mod
▸ mod<T
>(l
, r
): Expression
<T
>
l % r
Type parameters
Name | Type |
---|---|
T | extends NumericValue |
Parameters
Name | Type |
---|---|
l | ExpressionOrValue <T > |
r | ExpressionOrValue <T > |
Returns
Expression
<T
>
Defined in
neg
▸ neg<T
>(x
): Expression
<T
>
-x
Type parameters
Name | Type |
---|---|
T | extends NumericValue |
Parameters
Name | Type |
---|---|
x | ExpressionOrValue <T > |
Returns
Expression
<T
>
Defined in
and
▸ and(...exprs
): Expression
<boolean
>
exprs[0] && exprs[1] && ... && exprs[n]
Parameters
Name | Type |
---|---|
...exprs | ExpressionOrValue <boolean >[] |
Returns
Expression
<boolean
>
Defined in
or
▸ or(...exprs
): Expression
<boolean
>
exprs[0] || exprs[1] || ... || exprs[n]
Parameters
Name | Type |
---|---|
...exprs | ExpressionOrValue <boolean >[] |
Returns
Expression
<boolean
>
Defined in
not
▸ not(x
): Expression
<boolean
>
!x
Parameters
Name | Type |
---|---|
x | ExpressionOrValue <boolean > |
Returns
Expression
<boolean
>
Defined in
field
▸ field<FieldPath
>(fieldPath
): Expression
<FieldTypeFromFieldPath
<DocumentByInfo
<TableInfo
>, FieldPath
>>
Evaluates to the field at the given fieldPath
.
For example, in filter this can be used to examine the values being filtered.
Example
On this object:
{
"user": {
"isActive": true
}
}
field("user.isActive")
evaluates to true
.
Type parameters
Name | Type |
---|---|
FieldPath | extends string |
Parameters
Name | Type |
---|---|
fieldPath | FieldPath |
Returns
Expression
<FieldTypeFromFieldPath
<DocumentByInfo
<TableInfo
>, FieldPath
>>