不要怂,就是干,撸起袖子干!

Commit 3dbb318e by Sam Alexander Committed by Sushant

fix(types): add regex operators to WhereOperators (#10738)

1 parent f6dd9435
Showing with 40 additions and 0 deletions
...@@ -236,6 +236,42 @@ export interface WhereOperators { ...@@ -236,6 +236,42 @@ export interface WhereOperators {
* String contains value. * String contains value.
*/ */
[Op.substring]?: string; [Op.substring]?: string;
/**
* MySQL/PG only
*
* Matches regular expression, case sensitive
*
* Example: `[Op.regexp]: '^[h|a|t]'` becomes `REGEXP/~ '^[h|a|t]'`
*/
[Op.regexp]?: string;
/**
* MySQL/PG only
*
* Does not match regular expression, case sensitive
*
* Example: `[Op.notRegexp]: '^[h|a|t]'` becomes `NOT REGEXP/!~ '^[h|a|t]'`
*/
[Op.notRegexp]?: string;
/**
* PG only
*
* Matches regular expression, case insensitive
*
* Example: `[Op.iRegexp]: '^[h|a|t]'` becomes `~* '^[h|a|t]'`
*/
[Op.iRegexp]?: string;
/**
* PG only
*
* Does not match regular expression, case insensitive
*
* Example: `[Op.notIRegexp]: '^[h|a|t]'` becomes `!~* '^[h|a|t]'`
*/
[Op.notIRegexp]?: string;
} }
/** Example: `[Op.or]: [{a: 5}, {a: 6}]` becomes `(a = 5 OR a = 6)` */ /** Example: `[Op.or]: [{a: 5}, {a: 6}]` becomes `(a = 5 OR a = 6)` */
......
...@@ -41,6 +41,10 @@ let operators: WhereOperators = { ...@@ -41,6 +41,10 @@ let operators: WhereOperators = {
[Op.contains]: [1, 2], // @> [1, 2] (PG array contains operator) [Op.contains]: [1, 2], // @> [1, 2] (PG array contains operator)
[Op.contained]: [1, 2], // <@ [1, 2] (PG array contained by operator) [Op.contained]: [1, 2], // <@ [1, 2] (PG array contained by operator)
[Op.any]: [2, 3], // ANY ARRAY[2, 3]::INTEGER (PG only) [Op.any]: [2, 3], // ANY ARRAY[2, 3]::INTEGER (PG only)
[Op.regexp]: '^[h|a|t]', // REGEXP/~ '^[h|a|t]' (MySQL/PG only)
[Op.notRegexp]: '^[h|a|t]', // NOT REGEXP/!~ '^[h|a|t]' (MySQL/PG only)
[Op.iRegexp]: '^[h|a|t]', // ~* '^[h|a|t]' (PG only)
[Op.notIRegexp]: '^[h|a|t]' // !~* '^[h|a|t]' (PG only)
}; };
operators = { operators = {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!