@scx-js/scx-data 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/field_filter/FieldFilter.js +40 -0
- package/field_filter/FieldFilterBuilder.js +25 -0
- package/field_filter/FieldFilterImpl.js +81 -0
- package/field_filter/FilterMode.js +5 -0
- package/field_filter/serializer/FieldFilterSerializer.js +28 -0
- package/index.js +6 -0
- package/package.json +13 -0
- package/query/GroupBy.js +36 -0
- package/query/Logic.js +144 -0
- package/query/LogicType.js +7 -0
- package/query/OrderBy.js +42 -0
- package/query/OrderByType.js +8 -0
- package/query/Query.js +60 -0
- package/query/QueryBuilder.js +176 -0
- package/query/QueryImpl.js +143 -0
- package/query/QueryLike.js +89 -0
- package/query/QueryOption.js +74 -0
- package/query/Where.js +59 -0
- package/query/WhereClause.js +43 -0
- package/query/WhereType.js +109 -0
- package/query/serializer/GroupBySerializer.js +50 -0
- package/query/serializer/OrderBySerializer.js +54 -0
- package/query/serializer/QuerySerializer.js +35 -0
- package/query/serializer/WhereSerializer.js +79 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
class FieldFilter {
|
2
|
+
|
3
|
+
addIncluded(...fieldNames) {
|
4
|
+
return this;
|
5
|
+
}
|
6
|
+
|
7
|
+
addExcluded(...fieldNames) {
|
8
|
+
return this;
|
9
|
+
}
|
10
|
+
|
11
|
+
removeIncluded(...fieldNames) {
|
12
|
+
return this;
|
13
|
+
}
|
14
|
+
|
15
|
+
removeExcluded(...fieldNames) {
|
16
|
+
return this;
|
17
|
+
}
|
18
|
+
|
19
|
+
ignoreNullValue(ignoreNullValue) {
|
20
|
+
return this;
|
21
|
+
}
|
22
|
+
|
23
|
+
getFilterMode() {
|
24
|
+
}
|
25
|
+
|
26
|
+
getFieldNames() {
|
27
|
+
}
|
28
|
+
|
29
|
+
getIgnoreNullValue() {
|
30
|
+
}
|
31
|
+
|
32
|
+
clear() {
|
33
|
+
return this;
|
34
|
+
}
|
35
|
+
|
36
|
+
}
|
37
|
+
|
38
|
+
export {
|
39
|
+
FieldFilter,
|
40
|
+
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import {FieldFilterImpl} from "./FieldFilterImpl.js";
|
2
|
+
import {EXCLUDED, INCLUDED} from "./FilterMode.js";
|
3
|
+
|
4
|
+
/**
|
5
|
+
*
|
6
|
+
* @param fieldNames
|
7
|
+
* @return {FieldFilter}
|
8
|
+
*/
|
9
|
+
function ofIncluded(...fieldNames) {
|
10
|
+
return new FieldFilterImpl(INCLUDED).addIncluded(...fieldNames);
|
11
|
+
}
|
12
|
+
|
13
|
+
/**
|
14
|
+
*
|
15
|
+
* @param fieldNames
|
16
|
+
* @return {FieldFilter}
|
17
|
+
*/
|
18
|
+
function ofExcluded(...fieldNames) {
|
19
|
+
return new FieldFilterImpl(EXCLUDED).addExcluded(...fieldNames);
|
20
|
+
}
|
21
|
+
|
22
|
+
export {
|
23
|
+
ofIncluded,
|
24
|
+
ofExcluded,
|
25
|
+
};
|
@@ -0,0 +1,81 @@
|
|
1
|
+
import {EXCLUDED, INCLUDED} from "./FilterMode.js";
|
2
|
+
import {FieldFilter} from "./FieldFilter.js";
|
3
|
+
|
4
|
+
class FieldFilterImpl extends FieldFilter {
|
5
|
+
|
6
|
+
#filterMode;
|
7
|
+
#fieldNames;
|
8
|
+
#ignoreNullValue;
|
9
|
+
|
10
|
+
constructor(filterMode) {
|
11
|
+
super();
|
12
|
+
this.#filterMode = filterMode;
|
13
|
+
this.#fieldNames = new Set();
|
14
|
+
this.#ignoreNullValue = true;
|
15
|
+
}
|
16
|
+
|
17
|
+
addIncluded(...fieldNames) {
|
18
|
+
if (this.#filterMode === INCLUDED) {
|
19
|
+
this.addFieldNames(...fieldNames);
|
20
|
+
} else if (this.#filterMode === EXCLUDED) {
|
21
|
+
this.removeFieldNames(...fieldNames);
|
22
|
+
}
|
23
|
+
return this;
|
24
|
+
}
|
25
|
+
|
26
|
+
addExcluded(...fieldNames) {
|
27
|
+
if (this.#filterMode === EXCLUDED) {
|
28
|
+
this.addFieldNames(...fieldNames);
|
29
|
+
} else if (this.#filterMode === INCLUDED) {
|
30
|
+
this.removeFieldNames(...fieldNames);
|
31
|
+
}
|
32
|
+
return this;
|
33
|
+
}
|
34
|
+
|
35
|
+
removeIncluded(...fieldNames) {
|
36
|
+
return this.addExcluded(...fieldNames);
|
37
|
+
}
|
38
|
+
|
39
|
+
removeExcluded(...fieldNames) {
|
40
|
+
return this.addIncluded(...fieldNames);
|
41
|
+
}
|
42
|
+
|
43
|
+
ignoreNullValue(ignoreNullValue) {
|
44
|
+
this.#ignoreNullValue = ignoreNullValue;
|
45
|
+
return this;
|
46
|
+
}
|
47
|
+
|
48
|
+
getFilterMode() {
|
49
|
+
return this.#filterMode;
|
50
|
+
}
|
51
|
+
|
52
|
+
getFieldNames() {
|
53
|
+
return Array.from(this.#fieldNames);
|
54
|
+
}
|
55
|
+
|
56
|
+
getIgnoreNullValue() {
|
57
|
+
return this.#ignoreNullValue;
|
58
|
+
}
|
59
|
+
|
60
|
+
clear() {
|
61
|
+
this.#fieldNames.clear();
|
62
|
+
return this;
|
63
|
+
}
|
64
|
+
|
65
|
+
addFieldNames(...fieldNames) {
|
66
|
+
for (let fieldName of fieldNames) {
|
67
|
+
this.#fieldNames.add(fieldName);
|
68
|
+
}
|
69
|
+
return this;
|
70
|
+
}
|
71
|
+
|
72
|
+
removeFieldNames(...fieldNames) {
|
73
|
+
for (let fieldName of fieldNames) {
|
74
|
+
this.#fieldNames.delete(fieldName);
|
75
|
+
}
|
76
|
+
return this;
|
77
|
+
}
|
78
|
+
|
79
|
+
}
|
80
|
+
|
81
|
+
export {FieldFilterImpl};
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import {FieldFilter} from "../FieldFilter.js";
|
2
|
+
|
3
|
+
class FieldFilterSerializer {
|
4
|
+
|
5
|
+
serialize(obj) {
|
6
|
+
if (obj instanceof FieldFilter) {
|
7
|
+
return this.serializeFieldFilter(obj);
|
8
|
+
}
|
9
|
+
return obj;
|
10
|
+
}
|
11
|
+
|
12
|
+
serializeFieldFilter(fieldFilter) {
|
13
|
+
return {
|
14
|
+
"@type": "FieldFilter",
|
15
|
+
"filterMode": fieldFilter.getFilterMode(),
|
16
|
+
"fieldNames": fieldFilter.getFieldNames(),
|
17
|
+
"ignoreNullValue": fieldFilter.getIgnoreNullValue(),
|
18
|
+
};
|
19
|
+
}
|
20
|
+
|
21
|
+
}
|
22
|
+
|
23
|
+
const FIELD_FILTER_SERIALIZER = new FieldFilterSerializer();
|
24
|
+
|
25
|
+
export {
|
26
|
+
FIELD_FILTER_SERIALIZER,
|
27
|
+
FieldFilterSerializer,
|
28
|
+
};
|
package/index.js
ADDED
package/package.json
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"name": "@scx-js/scx-data",
|
3
|
+
"version": "0.0.1",
|
4
|
+
"description": "SCX Data",
|
5
|
+
"license": "MIT",
|
6
|
+
"author": "scx567888",
|
7
|
+
"main": "index.js",
|
8
|
+
"type": "module",
|
9
|
+
"repository": {
|
10
|
+
"type": "git",
|
11
|
+
"url": "https://github.com/scx567888/scx-js.git"
|
12
|
+
}
|
13
|
+
}
|
package/query/GroupBy.js
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
import {isBlank} from "../../scx-common/index.js";
|
2
|
+
import {QueryImpl} from "./QueryImpl.js";
|
3
|
+
import {QueryLike} from "./QueryLike.js";
|
4
|
+
import {ofInfo} from "./QueryOption.js";
|
5
|
+
|
6
|
+
class GroupBy extends QueryLike {
|
7
|
+
|
8
|
+
#name;
|
9
|
+
#info;
|
10
|
+
|
11
|
+
constructor(name, ...options) {
|
12
|
+
super();
|
13
|
+
if (isBlank(name)) {
|
14
|
+
throw new Error("GroupBy 参数错误 : 名称 不能为空 !!!");
|
15
|
+
}
|
16
|
+
this.#name = name;
|
17
|
+
this.#info = ofInfo(...options);
|
18
|
+
}
|
19
|
+
|
20
|
+
name() {
|
21
|
+
return this.#name;
|
22
|
+
}
|
23
|
+
|
24
|
+
info() {
|
25
|
+
return this.#info;
|
26
|
+
}
|
27
|
+
|
28
|
+
toQuery() {
|
29
|
+
return new QueryImpl().groupBy(this);
|
30
|
+
}
|
31
|
+
|
32
|
+
}
|
33
|
+
|
34
|
+
export {
|
35
|
+
GroupBy,
|
36
|
+
};
|
package/query/Logic.js
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
import {QueryLike} from "./QueryLike.js";
|
2
|
+
import {
|
3
|
+
BETWEEN,
|
4
|
+
EQUAL,
|
5
|
+
GREATER_THAN,
|
6
|
+
GREATER_THAN_OR_EQUAL,
|
7
|
+
IN,
|
8
|
+
IS_NOT_NULL,
|
9
|
+
IS_NULL,
|
10
|
+
JSON_CONTAINS,
|
11
|
+
JSON_OVERLAPS,
|
12
|
+
LESS_THAN,
|
13
|
+
LESS_THAN_OR_EQUAL,
|
14
|
+
LIKE,
|
15
|
+
LIKE_REGEX,
|
16
|
+
NOT_BETWEEN,
|
17
|
+
NOT_EQUAL,
|
18
|
+
NOT_IN,
|
19
|
+
NOT_LIKE,
|
20
|
+
NOT_LIKE_REGEX,
|
21
|
+
} from "./WhereType.js";
|
22
|
+
import {Where} from "./Where.js";
|
23
|
+
import {QueryImpl} from "./QueryImpl.js";
|
24
|
+
|
25
|
+
class Logic extends QueryLike {
|
26
|
+
|
27
|
+
#logicType;
|
28
|
+
#clauses;
|
29
|
+
|
30
|
+
constructor(logicType) {
|
31
|
+
super();
|
32
|
+
this.#logicType = logicType;
|
33
|
+
this.#clauses = [];
|
34
|
+
}
|
35
|
+
|
36
|
+
logicType() {
|
37
|
+
return this.#logicType;
|
38
|
+
}
|
39
|
+
|
40
|
+
clauses() {
|
41
|
+
return this.#clauses;
|
42
|
+
}
|
43
|
+
|
44
|
+
add(...logicCauses) {
|
45
|
+
for (let logicCause of logicCauses) {
|
46
|
+
if (logicCause == null) {
|
47
|
+
continue;
|
48
|
+
}
|
49
|
+
if (Array.isArray(logicCause)) {
|
50
|
+
this.add(...logicCause);
|
51
|
+
continue;
|
52
|
+
}
|
53
|
+
this.#clauses.push(logicCause);
|
54
|
+
}
|
55
|
+
return this;
|
56
|
+
}
|
57
|
+
|
58
|
+
clear() {
|
59
|
+
this.#clauses = [];
|
60
|
+
return this;
|
61
|
+
}
|
62
|
+
|
63
|
+
eq(fieldName, value, ...options) {
|
64
|
+
return this.add(new Where(fieldName, EQUAL, value, null, ...options));
|
65
|
+
}
|
66
|
+
|
67
|
+
ne(fieldName, value, ...options) {
|
68
|
+
return this.add(new Where(fieldName, NOT_EQUAL, value, null, ...options));
|
69
|
+
}
|
70
|
+
|
71
|
+
lt(fieldName, value, ...options) {
|
72
|
+
return this.add(new Where(fieldName, LESS_THAN, value, null, ...options));
|
73
|
+
}
|
74
|
+
|
75
|
+
le(fieldName, value, ...options) {
|
76
|
+
return this.add(new Where(fieldName, LESS_THAN_OR_EQUAL, value, null, ...options));
|
77
|
+
}
|
78
|
+
|
79
|
+
gt(fieldName, value, ...options) {
|
80
|
+
return this.add(new Where(fieldName, GREATER_THAN, value, null, ...options));
|
81
|
+
}
|
82
|
+
|
83
|
+
ge(fieldName, value, ...options) {
|
84
|
+
return this.add(new Where(fieldName, GREATER_THAN_OR_EQUAL, value, null, ...options));
|
85
|
+
}
|
86
|
+
|
87
|
+
|
88
|
+
isNull(fieldName, ...options) {
|
89
|
+
return this.add(new Where(fieldName, IS_NULL, null, null, ...options));
|
90
|
+
}
|
91
|
+
|
92
|
+
isNotNull(fieldName, ...options) {
|
93
|
+
return this.add(new Where(fieldName, IS_NOT_NULL, null, null, ...options));
|
94
|
+
}
|
95
|
+
|
96
|
+
like(fieldName, value, ...options) {
|
97
|
+
return this.add(new Where(fieldName, LIKE, value, null, ...options));
|
98
|
+
}
|
99
|
+
|
100
|
+
notLike(fieldName, value, ...options) {
|
101
|
+
return this.add(new Where(fieldName, NOT_LIKE, value, null, ...options));
|
102
|
+
}
|
103
|
+
|
104
|
+
likeRegex(fieldName, value, ...options) {
|
105
|
+
return this.add(new Where(fieldName, LIKE_REGEX, value, null, ...options));
|
106
|
+
}
|
107
|
+
|
108
|
+
notLikeRegex(fieldName, value, ...options) {
|
109
|
+
return this.add(new Where(fieldName, NOT_LIKE_REGEX, value, null, ...options));
|
110
|
+
}
|
111
|
+
|
112
|
+
in(fieldName, value, ...options) {
|
113
|
+
return this.add(new Where(fieldName, IN, value, null, ...options));
|
114
|
+
}
|
115
|
+
|
116
|
+
notIn(fieldName, value, ...options) {
|
117
|
+
return this.add(new Where(fieldName, NOT_IN, value, null, ...options));
|
118
|
+
}
|
119
|
+
|
120
|
+
between(fieldName, value1, value2, ...options) {
|
121
|
+
return this.add(new Where(fieldName, BETWEEN, value1, value2, ...options));
|
122
|
+
}
|
123
|
+
|
124
|
+
notBetween(fieldName, value1, value2, ...options) {
|
125
|
+
return this.add(new Where(fieldName, NOT_BETWEEN, value1, value2, ...options));
|
126
|
+
}
|
127
|
+
|
128
|
+
jsonContains(fieldName, value, ...options) {
|
129
|
+
return this.add(new Where(fieldName, JSON_CONTAINS, value, null, ...options));
|
130
|
+
}
|
131
|
+
|
132
|
+
jsonOverlaps(fieldName, value, ...options) {
|
133
|
+
return this.add(new Where(fieldName, JSON_OVERLAPS, value, null, ...options));
|
134
|
+
}
|
135
|
+
|
136
|
+
toQuery() {
|
137
|
+
return new QueryImpl().where(this);
|
138
|
+
}
|
139
|
+
|
140
|
+
}
|
141
|
+
|
142
|
+
export {
|
143
|
+
Logic,
|
144
|
+
};
|
package/query/OrderBy.js
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
import {isBlank} from "../../scx-common/index.js";
|
2
|
+
import {QueryImpl} from "./QueryImpl.js";
|
3
|
+
import {ofInfo} from "./QueryOption.js";
|
4
|
+
|
5
|
+
class OrderBy {
|
6
|
+
|
7
|
+
#name;
|
8
|
+
#orderByType;
|
9
|
+
#info;
|
10
|
+
|
11
|
+
constructor(name, orderByType, ...options) {
|
12
|
+
if (isBlank(name)) {
|
13
|
+
throw new Error("OrderBy 参数错误 : 名称 不能为空 !!!");
|
14
|
+
}
|
15
|
+
if (orderByType == null) {
|
16
|
+
throw new Error("OrderBy 参数错误 : orderByType 不能为空 !!!");
|
17
|
+
}
|
18
|
+
this.#name = name;
|
19
|
+
this.#orderByType = orderByType;
|
20
|
+
this.#info = ofInfo(...options);
|
21
|
+
}
|
22
|
+
|
23
|
+
|
24
|
+
name() {
|
25
|
+
return this.#name;
|
26
|
+
}
|
27
|
+
|
28
|
+
orderByType() {
|
29
|
+
return this.#orderByType;
|
30
|
+
}
|
31
|
+
|
32
|
+
info() {
|
33
|
+
return this.#info;
|
34
|
+
}
|
35
|
+
|
36
|
+
toQuery() {
|
37
|
+
return new QueryImpl().orderBy(this);
|
38
|
+
}
|
39
|
+
|
40
|
+
}
|
41
|
+
|
42
|
+
export {OrderBy};
|
package/query/Query.js
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
class Query {
|
2
|
+
|
3
|
+
where(...whereClauses) {
|
4
|
+
return this;
|
5
|
+
}
|
6
|
+
|
7
|
+
groupBy(...groupByClauses) {
|
8
|
+
return this;
|
9
|
+
}
|
10
|
+
|
11
|
+
orderBy(...orderByClauses) {
|
12
|
+
return this;
|
13
|
+
}
|
14
|
+
|
15
|
+
offset(limitOffset) {
|
16
|
+
return this;
|
17
|
+
}
|
18
|
+
|
19
|
+
limit(numberOfRows) {
|
20
|
+
return this;
|
21
|
+
}
|
22
|
+
|
23
|
+
getWhere() {
|
24
|
+
}
|
25
|
+
|
26
|
+
getGroupBy() {
|
27
|
+
}
|
28
|
+
|
29
|
+
getOrderBy() {
|
30
|
+
}
|
31
|
+
|
32
|
+
getOffset() {
|
33
|
+
}
|
34
|
+
|
35
|
+
getLimit() {
|
36
|
+
}
|
37
|
+
|
38
|
+
clearWhere() {
|
39
|
+
return this;
|
40
|
+
}
|
41
|
+
|
42
|
+
clearGroupBy() {
|
43
|
+
return this;
|
44
|
+
}
|
45
|
+
|
46
|
+
clearOrderBy() {
|
47
|
+
return this;
|
48
|
+
}
|
49
|
+
|
50
|
+
clearOffset() {
|
51
|
+
return this;
|
52
|
+
}
|
53
|
+
|
54
|
+
clearLimit() {
|
55
|
+
return this;
|
56
|
+
}
|
57
|
+
|
58
|
+
}
|
59
|
+
|
60
|
+
export {Query};
|
@@ -0,0 +1,176 @@
|
|
1
|
+
import {WhereClause} from "./WhereClause.js";
|
2
|
+
import {
|
3
|
+
BETWEEN,
|
4
|
+
EQUAL,
|
5
|
+
GREATER_THAN,
|
6
|
+
GREATER_THAN_OR_EQUAL,
|
7
|
+
IN,
|
8
|
+
IS_NOT_NULL,
|
9
|
+
IS_NULL,
|
10
|
+
JSON_CONTAINS,
|
11
|
+
JSON_OVERLAPS,
|
12
|
+
LESS_THAN,
|
13
|
+
LESS_THAN_OR_EQUAL,
|
14
|
+
LIKE,
|
15
|
+
LIKE_REGEX,
|
16
|
+
NOT_BETWEEN,
|
17
|
+
NOT_EQUAL,
|
18
|
+
NOT_IN,
|
19
|
+
NOT_LIKE,
|
20
|
+
NOT_LIKE_REGEX,
|
21
|
+
} from "./WhereType.js";
|
22
|
+
import {Where} from "./Where.js";
|
23
|
+
import {QueryImpl} from "./QueryImpl.js";
|
24
|
+
import {AND, OR} from "./LogicType.js";
|
25
|
+
import {OrderBy} from "./OrderBy.js";
|
26
|
+
import {ASC, DESC} from "./OrderByType.js";
|
27
|
+
import {Logic} from "./Logic.js";
|
28
|
+
|
29
|
+
function query(oldQuery) {
|
30
|
+
return new QueryImpl(oldQuery);
|
31
|
+
}
|
32
|
+
|
33
|
+
function where(...whereClauses) {
|
34
|
+
return new QueryImpl().where(...whereClauses);
|
35
|
+
}
|
36
|
+
|
37
|
+
function groupBy(...groupByClauses) {
|
38
|
+
return new QueryImpl().groupBy(...groupByClauses);
|
39
|
+
}
|
40
|
+
|
41
|
+
function orderBy(...orderByClauses) {
|
42
|
+
return new QueryImpl().orderBy(...orderByClauses);
|
43
|
+
}
|
44
|
+
|
45
|
+
function offset(limitOffset) {
|
46
|
+
return new QueryImpl().offset(limitOffset);
|
47
|
+
}
|
48
|
+
|
49
|
+
function limit(numberOfRows) {
|
50
|
+
return new QueryImpl().limit(numberOfRows);
|
51
|
+
}
|
52
|
+
|
53
|
+
function and(...clauses) {
|
54
|
+
return new Logic(AND).add(...clauses);
|
55
|
+
}
|
56
|
+
|
57
|
+
function or(...clauses) {
|
58
|
+
return new Logic(OR).add(...clauses);
|
59
|
+
}
|
60
|
+
|
61
|
+
function asc(name, ...options) {
|
62
|
+
return new OrderBy(name, ASC, ...options);
|
63
|
+
}
|
64
|
+
|
65
|
+
function desc(name, ...options) {
|
66
|
+
return new OrderBy(name, DESC, ...options);
|
67
|
+
}
|
68
|
+
|
69
|
+
function eq(fieldName, value, ...options) {
|
70
|
+
return new Where(fieldName, EQUAL, value, null, ...options);
|
71
|
+
}
|
72
|
+
|
73
|
+
function ne(fieldName, value, ...options) {
|
74
|
+
return new Where(fieldName, NOT_EQUAL, value, null, ...options);
|
75
|
+
}
|
76
|
+
|
77
|
+
|
78
|
+
function lt(fieldName, value, ...options) {
|
79
|
+
return new Where(fieldName, LESS_THAN, value, null, ...options);
|
80
|
+
}
|
81
|
+
|
82
|
+
function le(fieldName, value, ...options) {
|
83
|
+
return new Where(fieldName, LESS_THAN_OR_EQUAL, value, null, ...options);
|
84
|
+
}
|
85
|
+
|
86
|
+
function gt(fieldName, value, ...options) {
|
87
|
+
return new Where(fieldName, GREATER_THAN, value, null, ...options);
|
88
|
+
}
|
89
|
+
|
90
|
+
function ge(fieldName, value, ...options) {
|
91
|
+
return new Where(fieldName, GREATER_THAN_OR_EQUAL, value, null, ...options);
|
92
|
+
}
|
93
|
+
|
94
|
+
function isNull(fieldName, ...options) {
|
95
|
+
return new Where(fieldName, IS_NULL, null, null, ...options);
|
96
|
+
}
|
97
|
+
|
98
|
+
function isNotNull(fieldName, ...options) {
|
99
|
+
return new Where(fieldName, IS_NOT_NULL, null, null, ...options);
|
100
|
+
}
|
101
|
+
|
102
|
+
function like(fieldName, value, ...options) {
|
103
|
+
return new Where(fieldName, LIKE, value, null, ...options);
|
104
|
+
}
|
105
|
+
|
106
|
+
function notLike(fieldName, value, ...options) {
|
107
|
+
return new Where(fieldName, NOT_LIKE, value, null, ...options);
|
108
|
+
}
|
109
|
+
|
110
|
+
function likeRegex(fieldName, value, ...options) {
|
111
|
+
return new Where(fieldName, LIKE_REGEX, value, null, ...options);
|
112
|
+
}
|
113
|
+
|
114
|
+
function notLikeRegex(fieldName, value, ...options) {
|
115
|
+
return new Where(fieldName, NOT_LIKE_REGEX, value, null, ...options);
|
116
|
+
}
|
117
|
+
|
118
|
+
function in_(fieldName, value, ...options) {
|
119
|
+
return new Where(fieldName, IN, value, null, ...options);
|
120
|
+
}
|
121
|
+
|
122
|
+
function notIn(fieldName, value, ...options) {
|
123
|
+
return new Where(fieldName, NOT_IN, value, null, ...options);
|
124
|
+
}
|
125
|
+
|
126
|
+
function between(fieldName, value1, value2, ...options) {
|
127
|
+
return new Where(fieldName, BETWEEN, value1, value2, ...options);
|
128
|
+
}
|
129
|
+
|
130
|
+
function notBetween(fieldName, value1, value2, ...options) {
|
131
|
+
return new Where(fieldName, NOT_BETWEEN, value1, value2, ...options);
|
132
|
+
}
|
133
|
+
|
134
|
+
function jsonContains(fieldName, value, ...options) {
|
135
|
+
return new Where(fieldName, JSON_CONTAINS, value, null, ...options);
|
136
|
+
}
|
137
|
+
|
138
|
+
function jsonOverlaps(fieldName, value, ...options) {
|
139
|
+
return new Where(fieldName, JSON_OVERLAPS, value, null, ...options);
|
140
|
+
}
|
141
|
+
|
142
|
+
function whereClause(whereClause, params) {
|
143
|
+
return new WhereClause(whereClause, params);
|
144
|
+
}
|
145
|
+
|
146
|
+
|
147
|
+
export {
|
148
|
+
query,
|
149
|
+
where,
|
150
|
+
groupBy,
|
151
|
+
orderBy,
|
152
|
+
offset,
|
153
|
+
limit,
|
154
|
+
and,
|
155
|
+
or,
|
156
|
+
asc,
|
157
|
+
desc,
|
158
|
+
eq,
|
159
|
+
ne,
|
160
|
+
lt,
|
161
|
+
le,
|
162
|
+
gt,
|
163
|
+
ge,
|
164
|
+
isNull,
|
165
|
+
isNotNull,
|
166
|
+
like,
|
167
|
+
notLike,
|
168
|
+
likeRegex,
|
169
|
+
notLikeRegex,
|
170
|
+
in_,
|
171
|
+
notIn,
|
172
|
+
between,
|
173
|
+
notBetween,
|
174
|
+
jsonContains,
|
175
|
+
whereClause,
|
176
|
+
};
|