Page Contents

Home > @loopback/filter

filter package

A set of utility typings and filter builders to aid in constructing LoopBack filters using the builder pattern.

Remarks

This lightweight module provides strongly-typed typings and filter builders to intuitively construct LoopBack filters to be used against querying a LoopBack filter-compatible server over the network or within the server itself.

Classes

Class Description
FilterBuilder A builder for Filter. It provides fleunt APIs to add clauses such as fields, order, where, limit, offset, and include.
WhereBuilder A builder for Where object. It provides fluent APIs to add clauses such as and, or, and other operators.

Functions

Function Description
filterTemplate(strings, keys)  
isFilter(candidate) TypeGuard for Filter

Interfaces

Interface Description
AndClause And clause
Filter Query filter object
Inclusion <p>Inclusion of related items</p><p>Note: scope means filter on related items</p><p>Example: {relation: 'aRelationName', scope: {<AFilterObject>}}</p>
OrClause Or clause

Type Aliases

Type Alias Description
Condition Condition clause
Direction Order by direction
Fields <p>Selection of fields</p><p>Example: {afieldname: true}</p>
FilterExcludingWhere Filter without where property
InclusionFilter Inclusion filter type e.g. ‘property’, {relation: ‘property’}
KeyOf Key types of a given model, excluding operators
Operators Operators for where clauses
Order <p>Order by</p><p>Example: {afieldname: 'ASC'}</p>
PredicateComparison Matching predicate comparison
ShortHandEqualType Value types for {propertyName: value}
Where Where clause