Skip to content

Instantly share code, notes, and snippets.

@fforw
Last active June 30, 2020 15:04
Show Gist options
  • Select an option

  • Save fforw/27c11ce25d70ae35e0bef02acf72301d to your computer and use it in GitHub Desktop.

Select an option

Save fforw/27c11ce25d70ae35e0bef02acf72301d to your computer and use it in GitHub Desktop.
Filter DSL Methods
// Field conditions. Used in the form e.g. field("myField").lt(value(5)). Number is the number of arguments. For example
// between takes a lower and an upper value.
// "in" is kind of special and requires one values() argument
export const FIELD_CONDITIONS = {
"greaterOrEqual":1,
"lessOrEqual":1,
"lt":1,
"notBetweenSymmetric":2,
"notEqualIgnoreCase":1,
"betweenSymmetric":2,
"lessThan":1,
"equalIgnoreCase":1,
"isDistinctFrom":1,
"between":2,
"ge":1,
"greaterThan":1,
"isNotNull":0,
"notLikeRegex":1,
"notBetween":2,
"notEqual":1,
"isFalse":0,
"containsIgnoreCase":1,
"eq":1,
"gt":1,
"equal":1,
"likeRegex":1,
"isTrue":0,
"contains":1,
"notContainsIgnoreCase":1,
"notContains":1,
"ne":1,
"isNull":0,
"endsWith":1,
"le":1,
"isNotDistinctFrom":1,
"startsWith":1,
// 1 collection arg
"in" : 1
};
/**
* Operations on field objects, e.g. field("a").add(field("b")). In contrast to conditions they evaluate to a new field value,
* and not a boolean. Numbers again are number of arguments minus one for the field the operation is chained to.
*/
export const FIELD_OPERATIONS = {
"bitNand":1,
"mod":1,
"div":1,
"neg":0,
"rem":1,
"add":1,
"subtract":1,
"plus":1,
"bitAnd":1,
"bitXor":1,
"shl":1,
"unaryMinus":0,
"bitNor":1,
"shr":1,
"modulo":1,
"bitXNor":1,
"bitNot":0,
"sub":1,
"minus":1,
"mul":1,
"bitOr":1,
"times":1,
"pow":1,
"divide":1,
"power":1,
"multiply":1,
"unaryPlus":0,
// for sort order fields
"asc":0,
"desc":0
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment