Skip to main content

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:

ComparisonsError 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
ArithmeticError 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
LogicError 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

NameType
TableInfoextends GenericTableInfo

Methods

eq

eq<T>(l, r): Expression<boolean>

l === r

Type parameters

NameType
Textends undefined | Value

Parameters

NameType
lExpressionOrValue<T>
rExpressionOrValue<T>

Returns

Expression<boolean>

Defined in

server/filter_builder.ts:87


neq

neq<T>(l, r): Expression<boolean>

l !== r

Type parameters

NameType
Textends undefined | Value

Parameters

NameType
lExpressionOrValue<T>
rExpressionOrValue<T>

Returns

Expression<boolean>

Defined in

server/filter_builder.ts:97


lt

lt<T>(l, r): Expression<boolean>

l < r

Type parameters

NameType
Textends Value

Parameters

NameType
lExpressionOrValue<T>
rExpressionOrValue<T>

Returns

Expression<boolean>

Defined in

server/filter_builder.ts:107


lte

lte<T>(l, r): Expression<boolean>

l <= r

Type parameters

NameType
Textends Value

Parameters

NameType
lExpressionOrValue<T>
rExpressionOrValue<T>

Returns

Expression<boolean>

Defined in

server/filter_builder.ts:117


gt

gt<T>(l, r): Expression<boolean>

l > r

Type parameters

NameType
Textends Value

Parameters

NameType
lExpressionOrValue<T>
rExpressionOrValue<T>

Returns

Expression<boolean>

Defined in

server/filter_builder.ts:127


gte

gte<T>(l, r): Expression<boolean>

l >= r

Type parameters

NameType
Textends Value

Parameters

NameType
lExpressionOrValue<T>
rExpressionOrValue<T>

Returns

Expression<boolean>

Defined in

server/filter_builder.ts:137


add

add<T>(l, r): Expression<T>

l + r

Type parameters

NameType
Textends NumericValue

Parameters

NameType
lExpressionOrValue<T>
rExpressionOrValue<T>

Returns

Expression<T>

Defined in

server/filter_builder.ts:149


sub

sub<T>(l, r): Expression<T>

l - r

Type parameters

NameType
Textends NumericValue

Parameters

NameType
lExpressionOrValue<T>
rExpressionOrValue<T>

Returns

Expression<T>

Defined in

server/filter_builder.ts:159


mul

mul<T>(l, r): Expression<T>

l * r

Type parameters

NameType
Textends NumericValue

Parameters

NameType
lExpressionOrValue<T>
rExpressionOrValue<T>

Returns

Expression<T>

Defined in

server/filter_builder.ts:169


div

div<T>(l, r): Expression<T>

l / r

Type parameters

NameType
Textends NumericValue

Parameters

NameType
lExpressionOrValue<T>
rExpressionOrValue<T>

Returns

Expression<T>

Defined in

server/filter_builder.ts:179


mod

mod<T>(l, r): Expression<T>

l % r

Type parameters

NameType
Textends NumericValue

Parameters

NameType
lExpressionOrValue<T>
rExpressionOrValue<T>

Returns

Expression<T>

Defined in

server/filter_builder.ts:189


neg

neg<T>(x): Expression<T>

-x

Type parameters

NameType
Textends NumericValue

Parameters

NameType
xExpressionOrValue<T>

Returns

Expression<T>

Defined in

server/filter_builder.ts:199


and

and(...exprs): Expression<boolean>

exprs[0] && exprs[1] && ... && exprs[n]

Parameters

NameType
...exprsExpressionOrValue<boolean>[]

Returns

Expression<boolean>

Defined in

server/filter_builder.ts:208


or

or(...exprs): Expression<boolean>

exprs[0] || exprs[1] || ... || exprs[n]

Parameters

NameType
...exprsExpressionOrValue<boolean>[]

Returns

Expression<boolean>

Defined in

server/filter_builder.ts:215


not

not(x): Expression<boolean>

!x

Parameters

NameType
xExpressionOrValue<boolean>

Returns

Expression<boolean>

Defined in

server/filter_builder.ts:222


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

NameType
FieldPathextends string

Parameters

NameType
fieldPathFieldPath

Returns

Expression<FieldTypeFromFieldPath<DocumentByInfo<TableInfo>, FieldPath>>

Defined in

server/filter_builder.ts:246