Skip to content

Commit

Permalink
fix: make all filter operators uppercase (apache#378)
Browse files Browse the repository at this point in the history
* fix: make all filter operators uppercase

* fix: test case

* fix: convertFilter test case
  • Loading branch information
villebro authored and zhaoyongjie committed Nov 24, 2021
1 parent 66488d0 commit 67fea6e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
const UNARY_OPERATORS = ['IS NOT NULL', 'IS NULL'] as const;

/** List of operators that require another operand that is a single value */
const BINARY_OPERATORS = ['=', '!=', '>', '<', '>=', '<=', 'like', 'regex'] as const;
const BINARY_OPERATORS = ['=', '!=', '>', '<', '>=', '<=', 'LIKE', 'REGEX'] as const;

/** List of operators that require another operand that is a set */
const SET_OPERATORS = ['in', 'not in'] as const;
const SET_OPERATORS = ['IN', 'NOT IN'] as const;

//---------------------------------------------------
// Derived types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ describe('convertFilter', () => {
expressionType: 'SIMPLE',
clause: 'WHERE',
subject: 'toppings',
operator: 'in',
operator: 'IN',
comparator: ['boba', 'grass jelly'],
}),
).toEqual({
col: 'toppings',
op: 'in',
op: 'IN',
val: ['boba', 'grass jelly'],
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('Filter type guards', () => {
expressionType: 'SIMPLE',
clause: 'WHERE',
subject: 'tea',
operator: 'in',
operator: 'IN',
comparator: ['hojicha', 'earl grey'],
}),
).toEqual(true);
Expand Down

0 comments on commit 67fea6e

Please sign in to comment.