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

Commit b9338669 by Simon Schick

refactor(operators): use namespaced symbol names for operators (#10830)

BREAKING CHANGE:

If you have relied on accessing sequelize operators via `Symbol.for('gt')` etc. you must now prefix them with `sequelize.operator` eg.
`Symbol.for('sequelize.operator.gt')`
1 parent 14f72cdd
Showing with 44 additions and 39 deletions
...@@ -13,3 +13,8 @@ Sequelize v6 will only support Node 8 and up ...@@ -13,3 +13,8 @@ Sequelize v6 will only support Node 8 and up
Operator aliases were soft deprecated via the `opt-in` option `operatorAlises` in v5 they have been entirely removed. Operator aliases were soft deprecated via the `opt-in` option `operatorAlises` in v5 they have been entirely removed.
Please refer to previous changelogs for the migration guide. Please refer to previous changelogs for the migration guide.
### Renamed operator symbols
If you have relied on accessing sequelize operators via `Symbol.for('gt')` etc. you must now prefix them with `sequelize.operator` eg.
`Symbol.for('sequelize.operator.gt')`
...@@ -46,45 +46,45 @@ ...@@ -46,45 +46,45 @@
* @property join * @property join
*/ */
const Op = { const Op = {
eq: Symbol.for('eq'), eq: Symbol.for('sequelize.operator.eq'),
ne: Symbol.for('ne'), ne: Symbol.for('sequelize.operator.ne'),
gte: Symbol.for('gte'), gte: Symbol.for('sequelize.operator.gte'),
gt: Symbol.for('gt'), gt: Symbol.for('sequelize.operator.gt'),
lte: Symbol.for('lte'), lte: Symbol.for('sequelize.operator.lte'),
lt: Symbol.for('lt'), lt: Symbol.for('sequelize.operator.lt'),
not: Symbol.for('not'), not: Symbol.for('sequelize.operator.not'),
is: Symbol.for('is'), is: Symbol.for('sequelize.operator.is'),
in: Symbol.for('in'), in: Symbol.for('sequelize.operator.in'),
notIn: Symbol.for('notIn'), notIn: Symbol.for('sequelize.operator.notIn'),
like: Symbol.for('like'), like: Symbol.for('sequelize.operator.like'),
notLike: Symbol.for('notLike'), notLike: Symbol.for('sequelize.operator.notLike'),
iLike: Symbol.for('iLike'), iLike: Symbol.for('sequelize.operator.iLike'),
notILike: Symbol.for('notILike'), notILike: Symbol.for('sequelize.operator.notILike'),
startsWith: Symbol.for('startsWith'), startsWith: Symbol.for('sequelize.operator.startsWith'),
endsWith: Symbol.for('endsWith'), endsWith: Symbol.for('sequelize.operator.endsWith'),
substring: Symbol.for('substring'), substring: Symbol.for('sequelize.operator.substring'),
regexp: Symbol.for('regexp'), regexp: Symbol.for('sequelize.operator.regexp'),
notRegexp: Symbol.for('notRegexp'), notRegexp: Symbol.for('sequelize.operator.notRegexp'),
iRegexp: Symbol.for('iRegexp'), iRegexp: Symbol.for('sequelize.operator.iRegexp'),
notIRegexp: Symbol.for('notIRegexp'), notIRegexp: Symbol.for('sequelize.operator.notIRegexp'),
between: Symbol.for('between'), between: Symbol.for('sequelize.operator.between'),
notBetween: Symbol.for('notBetween'), notBetween: Symbol.for('sequelize.operator.notBetween'),
overlap: Symbol.for('overlap'), overlap: Symbol.for('sequelize.operator.overlap'),
contains: Symbol.for('contains'), contains: Symbol.for('sequelize.operator.contains'),
contained: Symbol.for('contained'), contained: Symbol.for('sequelize.operator.contained'),
adjacent: Symbol.for('adjacent'), adjacent: Symbol.for('sequelize.operator.adjacent'),
strictLeft: Symbol.for('strictLeft'), strictLeft: Symbol.for('sequelize.operator.strictLeft'),
strictRight: Symbol.for('strictRight'), strictRight: Symbol.for('sequelize.operator.strictRight'),
noExtendRight: Symbol.for('noExtendRight'), noExtendRight: Symbol.for('sequelize.operator.noExtendRight'),
noExtendLeft: Symbol.for('noExtendLeft'), noExtendLeft: Symbol.for('sequelize.operator.noExtendLeft'),
and: Symbol.for('and'), and: Symbol.for('sequelize.operator.and'),
or: Symbol.for('or'), or: Symbol.for('sequelize.operator.or'),
any: Symbol.for('any'), any: Symbol.for('sequelize.operator.any'),
all: Symbol.for('all'), all: Symbol.for('sequelize.operator.all'),
values: Symbol.for('values'), values: Symbol.for('sequelize.operator.values'),
col: Symbol.for('col'), col: Symbol.for('sequelize.operator.col'),
placeholder: Symbol.for('placeholder'), placeholder: Symbol.for('sequelize.operator.placeholder'),
join: Symbol.for('join') join: Symbol.for('sequelize.operator.join')
}; };
module.exports = Op; module.exports = Op;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!