operators.js
2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
'use strict';
/**
* Operator symbols to be used when querying data
*
* @see {@link Model#where}
*/
const Op = {
eq: Symbol('eq'),
ne: Symbol('ne'),
gte: Symbol('gte'),
gt: Symbol('gt'),
lte: Symbol('lte'),
lt: Symbol('lt'),
not: Symbol('not'),
is: Symbol('is'),
in: Symbol('in'),
notIn: Symbol('notIn'),
like: Symbol('like'),
notLike: Symbol('notLike'),
iLike: Symbol('iLike'),
notILike: Symbol('notILike'),
regexp: Symbol('regexp'),
notRegexp: Symbol('notRegexp'),
iRegexp: Symbol('iRegexp'),
notIRegexp: Symbol('notIRegexp'),
between: Symbol('between'),
notBetween: Symbol('notBetween'),
overlap: Symbol('overlap'),
contains: Symbol('contains'),
contained: Symbol('contained'),
adjacent: Symbol('adjacent'),
strictLeft: Symbol('strictLeft'),
strictRight: Symbol('strictRight'),
noExtendRight: Symbol('noExtendRight'),
noExtendLeft: Symbol('noExtendLeft'),
and: Symbol('and'),
or: Symbol('or'),
any: Symbol('any'),
all: Symbol('all'),
values: Symbol('values'),
col: Symbol('col'),
placeholder: Symbol('placeholder'),
join: Symbol('join'),
raw: Symbol('raw') //deprecated remove by v5.0
};
const Aliases = {
$eq: Op.eq,
$ne: Op.ne,
$gte: Op.gte,
$gt: Op.gt,
$lte: Op.lte,
$lt: Op.lt,
$not: Op.not,
$in: Op.in,
$notIn: Op.notIn,
$is: Op.is,
$like: Op.like,
$notLike: Op.notLike,
$iLike: Op.iLike,
$notILike: Op.notILike,
$regexp: Op.regexp,
$notRegexp: Op.notRegexp,
$iRegexp: Op.iRegexp,
$notIRegexp: Op.notIRegexp,
$between: Op.between,
$notBetween: Op.notBetween,
$overlap: Op.overlap,
$contains: Op.contains,
$contained: Op.contained,
$adjacent: Op.adjacent,
$strictLeft: Op.strictLeft,
$strictRight: Op.strictRight,
$noExtendRight: Op.noExtendRight,
$noExtendLeft: Op.noExtendLeft,
$and: Op.and,
$or: Op.or,
$any: Op.any,
$all: Op.all,
$values: Op.values,
$col: Op.col,
$raw: Op.raw //deprecated remove by v5.0
};
const LegacyAliases = { //deprecated remove by v5.0
'ne': Op.ne,
'not': Op.not,
'in': Op.in,
'notIn': Op.notIn,
'gte': Op.gte,
'gt': Op.gt,
'lte': Op.lte,
'lt': Op.lt,
'like': Op.like,
'ilike': Op.iLike,
'$ilike': Op.iLike,
'nlike': Op.notLike,
'$notlike': Op.notLike,
'notilike': Op.notILike,
'..': Op.between,
'between': Op.between,
'!..': Op.notBetween,
'notbetween': Op.notBetween,
'nbetween': Op.notBetween,
'overlap': Op.overlap,
'&&': Op.overlap,
'@>': Op.contains,
'<@': Op.contained
};
Op.Aliases = Aliases;
Op.LegacyAliases = Object.assign({}, LegacyAliases, Aliases);
module.exports = Op;