@scx-js/scx-data 0.0.1 → 0.0.2
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 -40
- package/field_filter/FieldFilterBuilder.js +25 -25
- package/field_filter/FieldFilterImpl.js +81 -81
- package/field_filter/FilterMode.js +5 -5
- package/field_filter/serializer/FieldFilterSerializer.js +28 -28
- package/index.js +22 -6
- package/package.json +1 -1
- package/query/GroupBy.js +36 -36
- package/query/Logic.js +144 -144
- package/query/LogicType.js +7 -7
- package/query/OrderBy.js +42 -42
- package/query/OrderByType.js +8 -8
- package/query/Query.js +60 -60
- package/query/QueryBuilder.js +176 -176
- package/query/QueryImpl.js +143 -143
- package/query/QueryLike.js +89 -89
- package/query/QueryOption.js +74 -74
- package/query/Where.js +59 -59
- package/query/WhereClause.js +43 -43
- package/query/WhereType.js +109 -109
- package/query/serializer/GroupBySerializer.js +50 -50
- package/query/serializer/OrderBySerializer.js +54 -54
- package/query/serializer/QuerySerializer.js +35 -35
- package/query/serializer/WhereSerializer.js +79 -79
package/query/QueryBuilder.js
CHANGED
@@ -1,176 +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
|
-
};
|
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
|
+
};
|
package/query/QueryImpl.js
CHANGED
@@ -1,143 +1,143 @@
|
|
1
|
-
import {Query} from "./Query.js";
|
2
|
-
|
3
|
-
class QueryImpl extends Query {
|
4
|
-
|
5
|
-
#where;
|
6
|
-
#groupBy;
|
7
|
-
#orderBy;
|
8
|
-
#offset;
|
9
|
-
#limit;
|
10
|
-
|
11
|
-
|
12
|
-
/**
|
13
|
-
* 创建 Query 对象
|
14
|
-
*/
|
15
|
-
constructor(old) {
|
16
|
-
super();
|
17
|
-
this.#where = [];
|
18
|
-
this.#groupBy = [];
|
19
|
-
this.#orderBy = [];
|
20
|
-
this.#offset = null;
|
21
|
-
this.#limit = null;
|
22
|
-
}
|
23
|
-
|
24
|
-
where(...whereClauses) {
|
25
|
-
this.clearWhere();
|
26
|
-
this.#addWhere(...whereClauses);
|
27
|
-
return this;
|
28
|
-
}
|
29
|
-
|
30
|
-
groupBy(...groupByClauses) {
|
31
|
-
this.clearGroupBy();
|
32
|
-
this.#addGroupBy(...groupByClauses);
|
33
|
-
return this;
|
34
|
-
}
|
35
|
-
|
36
|
-
|
37
|
-
orderBy(...orderByClauses) {
|
38
|
-
this.clearOrderBy();
|
39
|
-
this.#addOrderBy(...orderByClauses);
|
40
|
-
return this;
|
41
|
-
}
|
42
|
-
|
43
|
-
|
44
|
-
offset(limitOffset) {
|
45
|
-
this.#offset = limitOffset;
|
46
|
-
return this;
|
47
|
-
}
|
48
|
-
|
49
|
-
limit(numberOfRows) {
|
50
|
-
this.#limit = numberOfRows;
|
51
|
-
return this;
|
52
|
-
}
|
53
|
-
|
54
|
-
getWhere() {
|
55
|
-
return this.#where;
|
56
|
-
}
|
57
|
-
|
58
|
-
getGroupBy() {
|
59
|
-
return this.#groupBy;
|
60
|
-
}
|
61
|
-
|
62
|
-
getOrderBy() {
|
63
|
-
return this.#orderBy;
|
64
|
-
}
|
65
|
-
|
66
|
-
getOffset() {
|
67
|
-
return this.#offset;
|
68
|
-
}
|
69
|
-
|
70
|
-
getLimit() {
|
71
|
-
return this.#limit;
|
72
|
-
}
|
73
|
-
|
74
|
-
clearWhere() {
|
75
|
-
this.#where = [];
|
76
|
-
return this;
|
77
|
-
}
|
78
|
-
|
79
|
-
clearGroupBy() {
|
80
|
-
this.#groupBy = [];
|
81
|
-
return this;
|
82
|
-
}
|
83
|
-
|
84
|
-
clearOrderBy() {
|
85
|
-
this.#orderBy = [];
|
86
|
-
return this;
|
87
|
-
}
|
88
|
-
|
89
|
-
clearOffset() {
|
90
|
-
this.#offset = null;
|
91
|
-
return this;
|
92
|
-
}
|
93
|
-
|
94
|
-
clearLimit() {
|
95
|
-
this.#limit = null;
|
96
|
-
return this;
|
97
|
-
}
|
98
|
-
|
99
|
-
#addWhere(...whereClauses) {
|
100
|
-
for (let whereClause of whereClauses) {
|
101
|
-
if (whereClause == null) {
|
102
|
-
continue;
|
103
|
-
}
|
104
|
-
if (Array.isArray(whereClause)) {
|
105
|
-
this.#addWhere(...whereClause);
|
106
|
-
continue;
|
107
|
-
}
|
108
|
-
this.#where.push(whereClause);
|
109
|
-
}
|
110
|
-
return this;
|
111
|
-
}
|
112
|
-
|
113
|
-
#addGroupBy(...groupByClauses) {
|
114
|
-
for (let groupByClause of groupByClauses) {
|
115
|
-
if (groupByClause == null) {
|
116
|
-
continue;
|
117
|
-
}
|
118
|
-
if (Array.isArray(groupByClause)) {
|
119
|
-
this.#addGroupBy(...groupByClause);
|
120
|
-
continue;
|
121
|
-
}
|
122
|
-
this.#groupBy.push(groupByClause);
|
123
|
-
}
|
124
|
-
return this;
|
125
|
-
}
|
126
|
-
|
127
|
-
#addOrderBy(...orderByClauses) {
|
128
|
-
for (let orderByClause of orderByClauses) {
|
129
|
-
if (orderByClause == null) {
|
130
|
-
continue;
|
131
|
-
}
|
132
|
-
if (Array.isArray(orderByClause)) {
|
133
|
-
this.#addOrderBy(...orderByClause);
|
134
|
-
continue;
|
135
|
-
}
|
136
|
-
this.#orderBy.push(orderByClause);
|
137
|
-
}
|
138
|
-
return this;
|
139
|
-
}
|
140
|
-
|
141
|
-
}
|
142
|
-
|
143
|
-
export {QueryImpl};
|
1
|
+
import {Query} from "./Query.js";
|
2
|
+
|
3
|
+
class QueryImpl extends Query {
|
4
|
+
|
5
|
+
#where;
|
6
|
+
#groupBy;
|
7
|
+
#orderBy;
|
8
|
+
#offset;
|
9
|
+
#limit;
|
10
|
+
|
11
|
+
|
12
|
+
/**
|
13
|
+
* 创建 Query 对象
|
14
|
+
*/
|
15
|
+
constructor(old) {
|
16
|
+
super();
|
17
|
+
this.#where = [];
|
18
|
+
this.#groupBy = [];
|
19
|
+
this.#orderBy = [];
|
20
|
+
this.#offset = null;
|
21
|
+
this.#limit = null;
|
22
|
+
}
|
23
|
+
|
24
|
+
where(...whereClauses) {
|
25
|
+
this.clearWhere();
|
26
|
+
this.#addWhere(...whereClauses);
|
27
|
+
return this;
|
28
|
+
}
|
29
|
+
|
30
|
+
groupBy(...groupByClauses) {
|
31
|
+
this.clearGroupBy();
|
32
|
+
this.#addGroupBy(...groupByClauses);
|
33
|
+
return this;
|
34
|
+
}
|
35
|
+
|
36
|
+
|
37
|
+
orderBy(...orderByClauses) {
|
38
|
+
this.clearOrderBy();
|
39
|
+
this.#addOrderBy(...orderByClauses);
|
40
|
+
return this;
|
41
|
+
}
|
42
|
+
|
43
|
+
|
44
|
+
offset(limitOffset) {
|
45
|
+
this.#offset = limitOffset;
|
46
|
+
return this;
|
47
|
+
}
|
48
|
+
|
49
|
+
limit(numberOfRows) {
|
50
|
+
this.#limit = numberOfRows;
|
51
|
+
return this;
|
52
|
+
}
|
53
|
+
|
54
|
+
getWhere() {
|
55
|
+
return this.#where;
|
56
|
+
}
|
57
|
+
|
58
|
+
getGroupBy() {
|
59
|
+
return this.#groupBy;
|
60
|
+
}
|
61
|
+
|
62
|
+
getOrderBy() {
|
63
|
+
return this.#orderBy;
|
64
|
+
}
|
65
|
+
|
66
|
+
getOffset() {
|
67
|
+
return this.#offset;
|
68
|
+
}
|
69
|
+
|
70
|
+
getLimit() {
|
71
|
+
return this.#limit;
|
72
|
+
}
|
73
|
+
|
74
|
+
clearWhere() {
|
75
|
+
this.#where = [];
|
76
|
+
return this;
|
77
|
+
}
|
78
|
+
|
79
|
+
clearGroupBy() {
|
80
|
+
this.#groupBy = [];
|
81
|
+
return this;
|
82
|
+
}
|
83
|
+
|
84
|
+
clearOrderBy() {
|
85
|
+
this.#orderBy = [];
|
86
|
+
return this;
|
87
|
+
}
|
88
|
+
|
89
|
+
clearOffset() {
|
90
|
+
this.#offset = null;
|
91
|
+
return this;
|
92
|
+
}
|
93
|
+
|
94
|
+
clearLimit() {
|
95
|
+
this.#limit = null;
|
96
|
+
return this;
|
97
|
+
}
|
98
|
+
|
99
|
+
#addWhere(...whereClauses) {
|
100
|
+
for (let whereClause of whereClauses) {
|
101
|
+
if (whereClause == null) {
|
102
|
+
continue;
|
103
|
+
}
|
104
|
+
if (Array.isArray(whereClause)) {
|
105
|
+
this.#addWhere(...whereClause);
|
106
|
+
continue;
|
107
|
+
}
|
108
|
+
this.#where.push(whereClause);
|
109
|
+
}
|
110
|
+
return this;
|
111
|
+
}
|
112
|
+
|
113
|
+
#addGroupBy(...groupByClauses) {
|
114
|
+
for (let groupByClause of groupByClauses) {
|
115
|
+
if (groupByClause == null) {
|
116
|
+
continue;
|
117
|
+
}
|
118
|
+
if (Array.isArray(groupByClause)) {
|
119
|
+
this.#addGroupBy(...groupByClause);
|
120
|
+
continue;
|
121
|
+
}
|
122
|
+
this.#groupBy.push(groupByClause);
|
123
|
+
}
|
124
|
+
return this;
|
125
|
+
}
|
126
|
+
|
127
|
+
#addOrderBy(...orderByClauses) {
|
128
|
+
for (let orderByClause of orderByClauses) {
|
129
|
+
if (orderByClause == null) {
|
130
|
+
continue;
|
131
|
+
}
|
132
|
+
if (Array.isArray(orderByClause)) {
|
133
|
+
this.#addOrderBy(...orderByClause);
|
134
|
+
continue;
|
135
|
+
}
|
136
|
+
this.#orderBy.push(orderByClause);
|
137
|
+
}
|
138
|
+
return this;
|
139
|
+
}
|
140
|
+
|
141
|
+
}
|
142
|
+
|
143
|
+
export {QueryImpl};
|