PredicateFromFiltersMixin Class
Mixin contains functions for predicate build from filters object.
Methods
_filtersPredicate
()
BasePredicate | Undefined
private
Return predicate for QueryBuilder
or undefined
.
Returns:
BasePredicate | Undefined:
Predicate for QueryBuilder
or undefined
.
predicateForFilter
(
BasePredicate | Null
-
filter
Builds predicate for filter.
Parameters:
-
filter
ObjectObject (
{ name, condition, pattern }
) with parameters for filter.
Returns:
BasePredicate | Null:
Predicate to filter through.
Example:
// app/routes/example.js
...
predicateForFilter(filter) {
if (filter.type === 'string' && filter.condition === 'like') {
return new StringPredicate(filter.name).contains(filter.pattern);
}
return this._super(...arguments);
},
...