Constructor
new Filters()
Instantiation not allowed and will throw an error.
- Source:
Classes
Methods
(static) all(filtersnon-null) → {CompositeFilter}
Creates a new composite filter which matches objects that fit every provided filter.
Parameters:
Name | Type | Description |
---|---|---|
filters |
Array.<Filter> | an array of simple filters |
- Source:
Returns:
a new composite filter with `ALL` operator
- Type
- CompositeFilter
(static) compose(filtersnon-null, operatornon-null) → {CompositeFilter}
Creates a new composite filter which matches objects according to an array of filters with a
specified logical operator.
Parameters:
Name | Type | Description |
---|---|---|
filters |
Array.<Filter> | an array of simple filters |
operator |
CompositeFilter.CompositeOperator | a logical operator for `filters` |
- Source:
Returns:
a new composite filter
- Type
- CompositeFilter
(static) either(filtersnon-null) → {CompositeFilter}
Creates a new composite filter which matches objects that fit at least one
of the provided filters.
Parameters:
Name | Type | Description |
---|---|---|
filters |
Array.<Filter> | an array of simple filters |
- Source:
Returns:
a new composite filter with `EITHER` operator
- Type
- CompositeFilter
(static) eq(fieldPathnon-null, valuenon-null) → {Filter}
Creates a new filter for the value of an object field to be equal to the provided value.
Parameters:
Name | Type | Description |
---|---|---|
fieldPath |
String | a path to the object field |
value |
FieldValue | a value to compare with |
- Source:
Returns:
a new filter instance
- Type
- Filter
(static) ge(fieldPathnon-null, valuenon-null) → {Filter}
Creates a new filter for the value of an object field to be greater or equal compared to
the provided value.
Parameters:
Name | Type | Description |
---|---|---|
fieldPath |
String | a path to the object field |
value |
FieldValue | a value to compare with |
- Source:
Returns:
a new filter instance
- Type
- Filter
(static) gt(fieldPathnon-null, valuenon-null) → {Filter}
Creates a new filter for the value an object field to be greater than the provided value.
Parameters:
Name | Type | Description |
---|---|---|
fieldPath |
String | a path to the object field |
value |
FieldValue | a value to compare with |
- Source:
Returns:
a new filter instance
- Type
- Filter
(static) le(fieldPathnon-null, valuenon-null) → {Filter}
Creates a new filter for the value of an object field to be less or equal compared to
the provided value.
Parameters:
Name | Type | Description |
---|---|---|
fieldPath |
String | a path to the object field |
value |
FieldValue | a value to compare with |
- Source:
Returns:
a new filter instance
- Type
- Filter
(static) lt(fieldPathnon-null, valuenon-null) → {Filter}
Creates a new filter for the value of an object field to be less than the provided value.
Parameters:
Name | Type | Description |
---|---|---|
fieldPath |
String | a path to the object field |
value |
FieldValue | a value to compare with |
- Source:
Returns:
a new filter instance
- Type
- Filter
(static) with(fieldPathnon-null, operatornon-null, valuenon-null) → {Filter}
Creates a filter for an object field to match the provided value according to an operator.
Accepts various types of field values.
Parameters:
Name | Type | Description |
---|---|---|
fieldPath |
String | a path to the object field |
operator |
Filter.Operator | an operator to check the field value upon |
value |
FieldValue | a value to compare the field value to |
- Source:
Returns:
a new filter instance
- Type
- Filter
Examples
// Create filters with primitive values to compare
Filters.eq('description', 'Sample task description') // Wraps string in the Protobuf `StringValue`
Filters.gt('length', 12) // Wraps number in the Protobuf `Int32Value`
Filters.eq('multiline', false) // Wraps boolean in the Protobuf `BoolValue`
// Create filter for the primitive value of a custom type
Filters.gt('price', TypedMessage.float(7.41))
// Create filter for the time-based value
Filters.gt('whenCreated', new Date(2019, 5, 4)) // Converts the given date to the `Timestamp` message
// Create filter for the user-defined type
Filters.eq('status', Task.Status.COMPLETED)