@simplysm/orm-common 13.0.83 → 13.0.84
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/dist/ddl/initialize.d.ts +2 -2
- package/dist/ddl/initialize.js +1 -1
- package/dist/ddl/initialize.js.map +1 -1
- package/dist/ddl/table-ddl.d.ts +1 -1
- package/dist/exec/queryable.d.ts +115 -115
- package/dist/exec/queryable.js +68 -68
- package/dist/exec/queryable.js.map +1 -1
- package/dist/expr/expr.d.ts +248 -248
- package/dist/expr/expr.js +250 -250
- package/dist/query-builder/base/expr-renderer-base.d.ts +7 -7
- package/dist/query-builder/mssql/mssql-expr-renderer.d.ts +3 -3
- package/dist/query-builder/mssql/mssql-expr-renderer.d.ts.map +1 -1
- package/dist/query-builder/mssql/mssql-expr-renderer.js +5 -5
- package/dist/query-builder/mssql/mssql-query-builder.d.ts +2 -2
- package/dist/query-builder/mssql/mssql-query-builder.d.ts.map +1 -1
- package/dist/query-builder/mssql/mssql-query-builder.js +7 -7
- package/dist/query-builder/mysql/mysql-expr-renderer.d.ts +2 -2
- package/dist/query-builder/mysql/mysql-expr-renderer.d.ts.map +1 -1
- package/dist/query-builder/mysql/mysql-expr-renderer.js +4 -4
- package/dist/query-builder/mysql/mysql-query-builder.d.ts +10 -10
- package/dist/query-builder/mysql/mysql-query-builder.d.ts.map +1 -1
- package/dist/query-builder/mysql/mysql-query-builder.js +4 -4
- package/dist/query-builder/postgresql/postgresql-expr-renderer.d.ts +2 -2
- package/dist/query-builder/postgresql/postgresql-expr-renderer.d.ts.map +1 -1
- package/dist/query-builder/postgresql/postgresql-expr-renderer.js +4 -4
- package/dist/query-builder/postgresql/postgresql-query-builder.d.ts +8 -8
- package/dist/query-builder/postgresql/postgresql-query-builder.d.ts.map +1 -1
- package/dist/query-builder/postgresql/postgresql-query-builder.js +7 -7
- package/dist/query-builder/query-builder.d.ts +1 -1
- package/dist/schema/factory/column-builder.d.ts +46 -46
- package/dist/schema/factory/column-builder.js +25 -25
- package/dist/schema/factory/index-builder.d.ts +22 -22
- package/dist/schema/factory/index-builder.js +14 -14
- package/dist/schema/factory/relation-builder.d.ts +93 -93
- package/dist/schema/factory/relation-builder.d.ts.map +1 -1
- package/dist/schema/factory/relation-builder.js +37 -37
- package/dist/schema/procedure-builder.d.ts +38 -38
- package/dist/schema/procedure-builder.d.ts.map +1 -1
- package/dist/schema/procedure-builder.js +26 -26
- package/dist/schema/table-builder.d.ts +38 -38
- package/dist/schema/table-builder.d.ts.map +1 -1
- package/dist/schema/table-builder.js +29 -29
- package/dist/schema/view-builder.d.ts +26 -26
- package/dist/schema/view-builder.d.ts.map +1 -1
- package/dist/schema/view-builder.js +18 -18
- package/dist/types/db.d.ts +40 -40
- package/dist/types/expr.d.ts +75 -75
- package/dist/types/expr.d.ts.map +1 -1
- package/dist/types/query-def.d.ts +32 -32
- package/dist/types/query-def.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/ddl/initialize.ts +16 -16
- package/src/ddl/table-ddl.ts +1 -1
- package/src/exec/queryable.ts +163 -163
- package/src/expr/expr.ts +257 -257
- package/src/query-builder/base/expr-renderer-base.ts +8 -8
- package/src/query-builder/mssql/mssql-expr-renderer.ts +20 -20
- package/src/query-builder/mssql/mssql-query-builder.ts +28 -28
- package/src/query-builder/mysql/mysql-expr-renderer.ts +22 -22
- package/src/query-builder/mysql/mysql-query-builder.ts +65 -65
- package/src/query-builder/postgresql/postgresql-expr-renderer.ts +15 -15
- package/src/query-builder/postgresql/postgresql-query-builder.ts +43 -43
- package/src/query-builder/query-builder.ts +1 -1
- package/src/schema/factory/column-builder.ts +48 -48
- package/src/schema/factory/index-builder.ts +22 -22
- package/src/schema/factory/relation-builder.ts +95 -95
- package/src/schema/procedure-builder.ts +38 -38
- package/src/schema/table-builder.ts +38 -38
- package/src/schema/view-builder.ts +28 -28
- package/src/types/db.ts +41 -41
- package/src/types/expr.ts +79 -79
- package/src/types/query-def.ts +37 -37
- package/tests/ddl/basic.expected.ts +8 -8
package/src/types/expr.ts
CHANGED
|
@@ -2,18 +2,18 @@ import type { ColumnPrimitive, DataType } from "./column";
|
|
|
2
2
|
import type { SelectQueryDef } from "./query-def";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Date
|
|
5
|
+
* Date operation unit
|
|
6
6
|
*
|
|
7
|
-
* dateDiff, dateAdd
|
|
7
|
+
* Used in Date functions like dateDiff, dateAdd, etc.
|
|
8
8
|
*/
|
|
9
9
|
export type DateUnit = "year" | "month" | "day" | "hour" | "minute" | "second";
|
|
10
10
|
|
|
11
11
|
//#region ========== value expression ==========
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Column reference expression
|
|
15
15
|
*
|
|
16
|
-
* @property path - Column
|
|
16
|
+
* @property path - Column path (e.g. tableAlias.columnName)
|
|
17
17
|
*/
|
|
18
18
|
export interface ExprColumn {
|
|
19
19
|
type: "column";
|
|
@@ -21,9 +21,9 @@ export interface ExprColumn {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Literal value expression
|
|
25
25
|
*
|
|
26
|
-
* @property value - Column
|
|
26
|
+
* @property value - Column primitive value
|
|
27
27
|
*/
|
|
28
28
|
export interface ExprValue {
|
|
29
29
|
type: "value";
|
|
@@ -33,8 +33,8 @@ export interface ExprValue {
|
|
|
33
33
|
/**
|
|
34
34
|
* Raw SQL expression
|
|
35
35
|
*
|
|
36
|
-
* @property sql - SQL
|
|
37
|
-
* @property params -
|
|
36
|
+
* @property sql - SQL string (parameters denoted as {0}, {1})
|
|
37
|
+
* @property params - Parameter expression array
|
|
38
38
|
*/
|
|
39
39
|
export interface ExprRaw {
|
|
40
40
|
type: "raw";
|
|
@@ -44,9 +44,9 @@ export interface ExprRaw {
|
|
|
44
44
|
|
|
45
45
|
//#endregion
|
|
46
46
|
|
|
47
|
-
//#region ==========
|
|
47
|
+
//#region ========== Comparison operations (for WHERE) ==========
|
|
48
48
|
|
|
49
|
-
/**
|
|
49
|
+
/** Equality comparison (=) - NULL-safe */
|
|
50
50
|
export interface ExprEq {
|
|
51
51
|
type: "eq";
|
|
52
52
|
source: Expr;
|
|
@@ -81,7 +81,7 @@ export interface ExprLte {
|
|
|
81
81
|
target: Expr;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
/**
|
|
84
|
+
/** Range comparison (BETWEEN from AND to) */
|
|
85
85
|
export interface ExprBetween {
|
|
86
86
|
type: "between";
|
|
87
87
|
source: Expr;
|
|
@@ -89,41 +89,41 @@ export interface ExprBetween {
|
|
|
89
89
|
to?: Expr;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
/** NULL
|
|
92
|
+
/** NULL check (IS NULL) */
|
|
93
93
|
export interface ExprIsNull {
|
|
94
94
|
type: "null";
|
|
95
95
|
arg: Expr;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
/**
|
|
98
|
+
/** Pattern matching (LIKE) */
|
|
99
99
|
export interface ExprLike {
|
|
100
100
|
type: "like";
|
|
101
101
|
source: Expr;
|
|
102
102
|
pattern: Expr;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
/**
|
|
105
|
+
/** Regular expression matching (REGEXP) */
|
|
106
106
|
export interface ExprRegexp {
|
|
107
107
|
type: "regexp";
|
|
108
108
|
source: Expr;
|
|
109
109
|
pattern: Expr;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
/**
|
|
112
|
+
/** Value list inclusion check (IN) */
|
|
113
113
|
export interface ExprIn {
|
|
114
114
|
type: "in";
|
|
115
115
|
source: Expr;
|
|
116
116
|
values: Expr[];
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
/** Subquery result
|
|
119
|
+
/** Subquery result inclusion check (IN subquery) */
|
|
120
120
|
export interface ExprInQuery {
|
|
121
121
|
type: "inQuery";
|
|
122
122
|
source: Expr;
|
|
123
123
|
query: SelectQueryDef;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
/** Subquery
|
|
126
|
+
/** Subquery existence check (EXISTS) */
|
|
127
127
|
export interface ExprExists {
|
|
128
128
|
type: "exists";
|
|
129
129
|
query: SelectQueryDef;
|
|
@@ -131,21 +131,21 @@ export interface ExprExists {
|
|
|
131
131
|
|
|
132
132
|
//#endregion
|
|
133
133
|
|
|
134
|
-
//#region ==========
|
|
134
|
+
//#region ========== Logical operations ==========
|
|
135
135
|
|
|
136
|
-
/**
|
|
136
|
+
/** Logical negation (NOT) */
|
|
137
137
|
export interface ExprNot {
|
|
138
138
|
type: "not";
|
|
139
139
|
arg: WhereExpr;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
/**
|
|
142
|
+
/** Logical conjunction (AND) */
|
|
143
143
|
export interface ExprAnd {
|
|
144
144
|
type: "and";
|
|
145
145
|
conditions: WhereExpr[];
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
/**
|
|
148
|
+
/** Logical disjunction (OR) */
|
|
149
149
|
export interface ExprOr {
|
|
150
150
|
type: "or";
|
|
151
151
|
conditions: WhereExpr[];
|
|
@@ -155,33 +155,33 @@ export interface ExprOr {
|
|
|
155
155
|
|
|
156
156
|
//#region ========== String function ==========
|
|
157
157
|
|
|
158
|
-
/**
|
|
158
|
+
/** String concatenation (CONCAT) */
|
|
159
159
|
export interface ExprConcat {
|
|
160
160
|
type: "concat";
|
|
161
161
|
args: Expr[];
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
/**
|
|
164
|
+
/** Extract left N characters (LEFT) */
|
|
165
165
|
export interface ExprLeft {
|
|
166
166
|
type: "left";
|
|
167
167
|
source: Expr;
|
|
168
168
|
length: Expr;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
/**
|
|
171
|
+
/** Extract right N characters (RIGHT) */
|
|
172
172
|
export interface ExprRight {
|
|
173
173
|
type: "right";
|
|
174
174
|
source: Expr;
|
|
175
175
|
length: Expr;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
/**
|
|
178
|
+
/** Remove leading and trailing whitespace (TRIM) */
|
|
179
179
|
export interface ExprTrim {
|
|
180
180
|
type: "trim";
|
|
181
181
|
arg: Expr;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
/**
|
|
184
|
+
/** Left padding (LPAD) */
|
|
185
185
|
export interface ExprPadStart {
|
|
186
186
|
type: "padStart";
|
|
187
187
|
source: Expr;
|
|
@@ -189,7 +189,7 @@ export interface ExprPadStart {
|
|
|
189
189
|
fillString: Expr;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
/**
|
|
192
|
+
/** String replacement (REPLACE) */
|
|
193
193
|
export interface ExprReplace {
|
|
194
194
|
type: "replace";
|
|
195
195
|
source: Expr;
|
|
@@ -197,31 +197,31 @@ export interface ExprReplace {
|
|
|
197
197
|
to: Expr;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
/**
|
|
200
|
+
/** Uppercase transform (UPPER) */
|
|
201
201
|
export interface ExprUpper {
|
|
202
202
|
type: "upper";
|
|
203
203
|
arg: Expr;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
/**
|
|
206
|
+
/** Lowercase transform (LOWER) */
|
|
207
207
|
export interface ExprLower {
|
|
208
208
|
type: "lower";
|
|
209
209
|
arg: Expr;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
/**
|
|
212
|
+
/** Character length (CHAR_LENGTH) */
|
|
213
213
|
export interface ExprLength {
|
|
214
214
|
type: "length";
|
|
215
215
|
arg: Expr;
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
/**
|
|
218
|
+
/** Byte length (LENGTH/DATALENGTH) */
|
|
219
219
|
export interface ExprByteLength {
|
|
220
220
|
type: "byteLength";
|
|
221
221
|
arg: Expr;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
/**
|
|
224
|
+
/** Substring (SUBSTRING) */
|
|
225
225
|
export interface ExprSubstring {
|
|
226
226
|
type: "substring";
|
|
227
227
|
source: Expr;
|
|
@@ -229,7 +229,7 @@ export interface ExprSubstring {
|
|
|
229
229
|
length?: Expr;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
/**
|
|
232
|
+
/** String position (LOCATE/CHARINDEX/POSITION) */
|
|
233
233
|
export interface ExprIndexOf {
|
|
234
234
|
type: "indexOf";
|
|
235
235
|
source: Expr;
|
|
@@ -240,26 +240,26 @@ export interface ExprIndexOf {
|
|
|
240
240
|
|
|
241
241
|
//#region ========== Number function ==========
|
|
242
242
|
|
|
243
|
-
/**
|
|
243
|
+
/** Absolute value (ABS) */
|
|
244
244
|
export interface ExprAbs {
|
|
245
245
|
type: "abs";
|
|
246
246
|
arg: Expr;
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
/**
|
|
249
|
+
/** Rounding (ROUND) */
|
|
250
250
|
export interface ExprRound {
|
|
251
251
|
type: "round";
|
|
252
252
|
arg: Expr;
|
|
253
253
|
digits: number;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
/**
|
|
256
|
+
/** Ceiling (CEIL) */
|
|
257
257
|
export interface ExprCeil {
|
|
258
258
|
type: "ceil";
|
|
259
259
|
arg: Expr;
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
/**
|
|
262
|
+
/** Floor (FLOOR) */
|
|
263
263
|
export interface ExprFloor {
|
|
264
264
|
type: "floor";
|
|
265
265
|
arg: Expr;
|
|
@@ -269,61 +269,61 @@ export interface ExprFloor {
|
|
|
269
269
|
|
|
270
270
|
//#region ========== Date function ==========
|
|
271
271
|
|
|
272
|
-
/**
|
|
272
|
+
/** Year extraction (YEAR) */
|
|
273
273
|
export interface ExprYear {
|
|
274
274
|
type: "year";
|
|
275
275
|
arg: Expr;
|
|
276
276
|
}
|
|
277
277
|
|
|
278
|
-
/**
|
|
278
|
+
/** Month extraction (MONTH) */
|
|
279
279
|
export interface ExprMonth {
|
|
280
280
|
type: "month";
|
|
281
281
|
arg: Expr;
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
/**
|
|
284
|
+
/** Day extraction (DAY) */
|
|
285
285
|
export interface ExprDay {
|
|
286
286
|
type: "day";
|
|
287
287
|
arg: Expr;
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
/**
|
|
290
|
+
/** Hour extraction (HOUR) */
|
|
291
291
|
export interface ExprHour {
|
|
292
292
|
type: "hour";
|
|
293
293
|
arg: Expr;
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
/**
|
|
296
|
+
/** Minute extraction (MINUTE) */
|
|
297
297
|
export interface ExprMinute {
|
|
298
298
|
type: "minute";
|
|
299
299
|
arg: Expr;
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
/**
|
|
302
|
+
/** Second extraction (SECOND) */
|
|
303
303
|
export interface ExprSecond {
|
|
304
304
|
type: "second";
|
|
305
305
|
arg: Expr;
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
-
/** ISO
|
|
308
|
+
/** ISO week number (WEEK) */
|
|
309
309
|
export interface ExprIsoWeek {
|
|
310
310
|
type: "isoWeek";
|
|
311
311
|
arg: Expr;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
/** ISO
|
|
314
|
+
/** ISO week start date */
|
|
315
315
|
export interface ExprIsoWeekStartDate {
|
|
316
316
|
type: "isoWeekStartDate";
|
|
317
317
|
arg: Expr;
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
-
/** ISO
|
|
320
|
+
/** ISO year-month (YYYYMM format) */
|
|
321
321
|
export interface ExprIsoYearMonth {
|
|
322
322
|
type: "isoYearMonth";
|
|
323
323
|
arg: Expr;
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
/** Date
|
|
326
|
+
/** Date difference (DATEDIFF) */
|
|
327
327
|
export interface ExprDateDiff {
|
|
328
328
|
type: "dateDiff";
|
|
329
329
|
unit: DateUnit;
|
|
@@ -331,7 +331,7 @@ export interface ExprDateDiff {
|
|
|
331
331
|
to: Expr;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
/** Date
|
|
334
|
+
/** Date arithmetic (DATEADD) */
|
|
335
335
|
export interface ExprDateAdd {
|
|
336
336
|
type: "dateAdd";
|
|
337
337
|
unit: DateUnit;
|
|
@@ -339,7 +339,7 @@ export interface ExprDateAdd {
|
|
|
339
339
|
value: Expr;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
/** Date
|
|
342
|
+
/** Date format (FORMAT/DATE_FORMAT) */
|
|
343
343
|
export interface ExprFormatDate {
|
|
344
344
|
type: "formatDate";
|
|
345
345
|
source: Expr;
|
|
@@ -348,22 +348,22 @@ export interface ExprFormatDate {
|
|
|
348
348
|
|
|
349
349
|
//#endregion
|
|
350
350
|
|
|
351
|
-
//#region ==========
|
|
351
|
+
//#region ========== Conditional ==========
|
|
352
352
|
|
|
353
|
-
/** NULL
|
|
353
|
+
/** NULL replacement (COALESCE - returns first non-null) */
|
|
354
354
|
export interface ExprCoalesce {
|
|
355
355
|
type: "coalesce";
|
|
356
356
|
args: Expr[];
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
/**
|
|
359
|
+
/** Conditional NULL (NULLIF - returns NULL if source === value) */
|
|
360
360
|
export interface ExprNullIf {
|
|
361
361
|
type: "nullIf";
|
|
362
362
|
source: Expr;
|
|
363
363
|
value: Expr;
|
|
364
364
|
}
|
|
365
365
|
|
|
366
|
-
/**
|
|
366
|
+
/** Transform condition to value (boolean -> 0/1) */
|
|
367
367
|
export interface ExprIs {
|
|
368
368
|
type: "is";
|
|
369
369
|
condition: WhereExpr;
|
|
@@ -386,34 +386,34 @@ export interface ExprIf {
|
|
|
386
386
|
|
|
387
387
|
//#endregion
|
|
388
388
|
|
|
389
|
-
//#region ==========
|
|
389
|
+
//#region ========== Aggregation ==========
|
|
390
390
|
|
|
391
|
-
/**
|
|
391
|
+
/** Record count (COUNT) */
|
|
392
392
|
export interface ExprCount {
|
|
393
393
|
type: "count";
|
|
394
394
|
arg?: Expr;
|
|
395
395
|
distinct?: boolean;
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
-
/**
|
|
398
|
+
/** Sum (SUM) */
|
|
399
399
|
export interface ExprSum {
|
|
400
400
|
type: "sum";
|
|
401
401
|
arg: Expr;
|
|
402
402
|
}
|
|
403
403
|
|
|
404
|
-
/**
|
|
404
|
+
/** Average (AVG) */
|
|
405
405
|
export interface ExprAvg {
|
|
406
406
|
type: "avg";
|
|
407
407
|
arg: Expr;
|
|
408
408
|
}
|
|
409
409
|
|
|
410
|
-
/**
|
|
410
|
+
/** Maximum value (MAX) */
|
|
411
411
|
export interface ExprMax {
|
|
412
412
|
type: "max";
|
|
413
413
|
arg: Expr;
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
/**
|
|
416
|
+
/** Minimum value (MIN) */
|
|
417
417
|
export interface ExprMin {
|
|
418
418
|
type: "min";
|
|
419
419
|
arg: Expr;
|
|
@@ -423,29 +423,29 @@ export interface ExprMin {
|
|
|
423
423
|
|
|
424
424
|
//#region ========== Other ==========
|
|
425
425
|
|
|
426
|
-
/**
|
|
426
|
+
/** Maximum value selection (GREATEST) */
|
|
427
427
|
export interface ExprGreatest {
|
|
428
428
|
type: "greatest";
|
|
429
429
|
args: Expr[];
|
|
430
430
|
}
|
|
431
431
|
|
|
432
|
-
/**
|
|
432
|
+
/** Minimum value selection (LEAST) */
|
|
433
433
|
export interface ExprLeast {
|
|
434
434
|
type: "least";
|
|
435
435
|
args: Expr[];
|
|
436
436
|
}
|
|
437
437
|
|
|
438
|
-
/**
|
|
438
|
+
/** Row number (simple ROW_NUMBER version) */
|
|
439
439
|
export interface ExprRowNum {
|
|
440
440
|
type: "rowNum";
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
-
/**
|
|
443
|
+
/** Random number (RAND/RANDOM) */
|
|
444
444
|
export interface ExprRandom {
|
|
445
445
|
type: "random";
|
|
446
446
|
}
|
|
447
447
|
|
|
448
|
-
/**
|
|
448
|
+
/** Type cast (CAST) */
|
|
449
449
|
export interface ExprCast {
|
|
450
450
|
type: "cast";
|
|
451
451
|
source: Expr;
|
|
@@ -479,7 +479,7 @@ export interface WinFnNtile {
|
|
|
479
479
|
n: number;
|
|
480
480
|
}
|
|
481
481
|
|
|
482
|
-
/** LAG() -
|
|
482
|
+
/** LAG() - Previous row value */
|
|
483
483
|
export interface WinFnLag {
|
|
484
484
|
type: "lag";
|
|
485
485
|
column: Expr;
|
|
@@ -487,7 +487,7 @@ export interface WinFnLag {
|
|
|
487
487
|
default?: Expr;
|
|
488
488
|
}
|
|
489
489
|
|
|
490
|
-
/** LEAD() -
|
|
490
|
+
/** LEAD() - Next row value */
|
|
491
491
|
export interface WinFnLead {
|
|
492
492
|
type: "lead";
|
|
493
493
|
column: Expr;
|
|
@@ -540,7 +540,7 @@ export interface WinFnMax {
|
|
|
540
540
|
/**
|
|
541
541
|
* Window function union type
|
|
542
542
|
*
|
|
543
|
-
*
|
|
543
|
+
* Ranking, navigation, and aggregation Window functions
|
|
544
544
|
*/
|
|
545
545
|
export type WinFn =
|
|
546
546
|
| WinFnRowNumber
|
|
@@ -558,10 +558,10 @@ export type WinFn =
|
|
|
558
558
|
| WinFnMax;
|
|
559
559
|
|
|
560
560
|
/**
|
|
561
|
-
* Window
|
|
561
|
+
* Window specification (OVER clause)
|
|
562
562
|
*
|
|
563
|
-
* @property partitionBy - PARTITION BY expression
|
|
564
|
-
* @property orderBy - ORDER BY [column,
|
|
563
|
+
* @property partitionBy - PARTITION BY expression list
|
|
564
|
+
* @property orderBy - ORDER BY [column, direction] list
|
|
565
565
|
*/
|
|
566
566
|
export interface WinSpec {
|
|
567
567
|
partitionBy?: Expr[];
|
|
@@ -571,7 +571,7 @@ export interface WinSpec {
|
|
|
571
571
|
/**
|
|
572
572
|
* Window expression
|
|
573
573
|
*
|
|
574
|
-
* Window function + Window
|
|
574
|
+
* Window function + Window specification composition
|
|
575
575
|
*/
|
|
576
576
|
export interface ExprWindow {
|
|
577
577
|
type: "window";
|
|
@@ -583,7 +583,7 @@ export interface ExprWindow {
|
|
|
583
583
|
|
|
584
584
|
//#region ========== System ==========
|
|
585
585
|
|
|
586
|
-
/**
|
|
586
|
+
/** Scalar Subquery */
|
|
587
587
|
export interface ExprSubquery {
|
|
588
588
|
type: "subquery";
|
|
589
589
|
queryDef: SelectQueryDef;
|
|
@@ -594,10 +594,10 @@ export interface ExprSubquery {
|
|
|
594
594
|
//#region ========== Union Types ==========
|
|
595
595
|
|
|
596
596
|
/**
|
|
597
|
-
*
|
|
597
|
+
* Expression used in WHERE clause (returns boolean)
|
|
598
598
|
*
|
|
599
|
-
* comparison
|
|
600
|
-
* where(), having()
|
|
599
|
+
* Union type of comparison operations + logical operations
|
|
600
|
+
* Used in where(), having(), etc.
|
|
601
601
|
*/
|
|
602
602
|
export type WhereExpr =
|
|
603
603
|
// Comparison
|
|
@@ -620,12 +620,12 @@ export type WhereExpr =
|
|
|
620
620
|
| ExprOr;
|
|
621
621
|
|
|
622
622
|
/**
|
|
623
|
-
*
|
|
623
|
+
* All expression union type
|
|
624
624
|
*
|
|
625
|
-
* value,
|
|
626
|
-
* select(), orderBy()
|
|
625
|
+
* All expressions including value, string, number, date, conditional, aggregation, window, etc.
|
|
626
|
+
* Used in select(), orderBy(), etc.
|
|
627
627
|
*
|
|
628
|
-
* @see {@link WhereExpr} WHERE
|
|
628
|
+
* @see {@link WhereExpr} WHERE clause-specific expression
|
|
629
629
|
*/
|
|
630
630
|
export type Expr =
|
|
631
631
|
// Value
|