@simplysm/orm-common 13.0.69 → 13.0.70
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/README.md +54 -1447
- package/dist/create-db-context.d.ts +10 -10
- package/dist/create-db-context.js +9 -9
- package/dist/create-db-context.js.map +1 -1
- package/dist/ddl/column-ddl.d.ts +4 -4
- package/dist/ddl/initialize.d.ts +17 -17
- package/dist/ddl/initialize.js +2 -2
- package/dist/ddl/initialize.js.map +1 -1
- package/dist/ddl/relation-ddl.d.ts +6 -6
- package/dist/ddl/schema-ddl.d.ts +4 -4
- package/dist/ddl/table-ddl.d.ts +24 -24
- package/dist/ddl/table-ddl.js +4 -4
- package/dist/ddl/table-ddl.js.map +1 -1
- package/dist/errors/db-transaction-error.d.ts +15 -15
- package/dist/errors/db-transaction-error.d.ts.map +1 -1
- package/dist/exec/executable.d.ts +23 -23
- package/dist/exec/executable.js +3 -3
- package/dist/exec/executable.js.map +1 -1
- package/dist/exec/queryable.d.ts +160 -160
- package/dist/exec/queryable.js +119 -119
- package/dist/exec/queryable.js.map +1 -1
- package/dist/exec/search-parser.d.ts +37 -37
- package/dist/exec/search-parser.d.ts.map +1 -1
- package/dist/expr/expr-unit.d.ts +4 -4
- package/dist/expr/expr.d.ts +257 -257
- package/dist/expr/expr.js +265 -265
- package/dist/expr/expr.js.map +1 -1
- package/dist/query-builder/base/expr-renderer-base.d.ts +9 -9
- package/dist/query-builder/base/expr-renderer-base.js +2 -2
- package/dist/query-builder/base/expr-renderer-base.js.map +1 -1
- package/dist/query-builder/base/query-builder-base.d.ts +26 -26
- package/dist/query-builder/base/query-builder-base.d.ts.map +1 -1
- package/dist/query-builder/base/query-builder-base.js +22 -22
- package/dist/query-builder/base/query-builder-base.js.map +1 -1
- package/dist/query-builder/mssql/mssql-expr-renderer.d.ts +4 -4
- package/dist/query-builder/mssql/mssql-expr-renderer.d.ts.map +1 -1
- package/dist/query-builder/mssql/mssql-expr-renderer.js +18 -18
- package/dist/query-builder/mssql/mssql-expr-renderer.js.map +1 -1
- 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 +11 -11
- package/dist/query-builder/mssql/mssql-query-builder.js.map +1 -1
- package/dist/query-builder/mysql/mysql-expr-renderer.d.ts +4 -4
- package/dist/query-builder/mysql/mysql-expr-renderer.d.ts.map +1 -1
- package/dist/query-builder/mysql/mysql-expr-renderer.js +17 -17
- package/dist/query-builder/mysql/mysql-expr-renderer.js.map +1 -1
- package/dist/query-builder/mysql/mysql-query-builder.d.ts +8 -8
- package/dist/query-builder/mysql/mysql-query-builder.d.ts.map +1 -1
- package/dist/query-builder/mysql/mysql-query-builder.js +5 -5
- package/dist/query-builder/mysql/mysql-query-builder.js.map +1 -1
- package/dist/query-builder/postgresql/postgresql-expr-renderer.d.ts +4 -4
- package/dist/query-builder/postgresql/postgresql-expr-renderer.d.ts.map +1 -1
- package/dist/query-builder/postgresql/postgresql-expr-renderer.js +17 -17
- package/dist/query-builder/postgresql/postgresql-expr-renderer.js.map +1 -1
- package/dist/query-builder/postgresql/postgresql-query-builder.d.ts +5 -5
- package/dist/query-builder/postgresql/postgresql-query-builder.d.ts.map +1 -1
- package/dist/query-builder/postgresql/postgresql-query-builder.js +8 -8
- package/dist/query-builder/postgresql/postgresql-query-builder.js.map +1 -1
- package/dist/query-builder/query-builder.d.ts +1 -1
- package/dist/schema/factory/column-builder.d.ts +79 -79
- package/dist/schema/factory/column-builder.js +42 -42
- package/dist/schema/factory/index-builder.d.ts +39 -39
- package/dist/schema/factory/index-builder.js +26 -26
- package/dist/schema/factory/relation-builder.d.ts +99 -99
- package/dist/schema/factory/relation-builder.d.ts.map +1 -1
- package/dist/schema/factory/relation-builder.js +38 -38
- package/dist/schema/procedure-builder.d.ts +49 -49
- package/dist/schema/procedure-builder.d.ts.map +1 -1
- package/dist/schema/procedure-builder.js +33 -33
- package/dist/schema/table-builder.d.ts +59 -59
- package/dist/schema/table-builder.d.ts.map +1 -1
- package/dist/schema/table-builder.js +43 -43
- package/dist/schema/view-builder.d.ts +49 -49
- package/dist/schema/view-builder.d.ts.map +1 -1
- package/dist/schema/view-builder.js +32 -32
- package/dist/types/column.d.ts +22 -22
- package/dist/types/column.js +1 -1
- package/dist/types/column.js.map +1 -1
- package/dist/types/db.d.ts +40 -40
- package/dist/types/expr.d.ts +59 -59
- package/dist/types/expr.d.ts.map +1 -1
- package/dist/types/query-def.d.ts +44 -44
- package/dist/types/query-def.d.ts.map +1 -1
- package/dist/utils/result-parser.d.ts +11 -11
- package/dist/utils/result-parser.js +3 -3
- package/dist/utils/result-parser.js.map +1 -1
- package/package.json +5 -5
- package/src/create-db-context.ts +20 -20
- package/src/ddl/column-ddl.ts +4 -4
- package/src/ddl/initialize.ts +259 -259
- package/src/ddl/relation-ddl.ts +89 -89
- package/src/ddl/schema-ddl.ts +4 -4
- package/src/ddl/table-ddl.ts +189 -189
- package/src/errors/db-transaction-error.ts +13 -13
- package/src/exec/executable.ts +25 -25
- package/src/exec/queryable.ts +2033 -2033
- package/src/exec/search-parser.ts +57 -57
- package/src/expr/expr-unit.ts +4 -4
- package/src/expr/expr.ts +2140 -2140
- package/src/query-builder/base/expr-renderer-base.ts +237 -237
- package/src/query-builder/base/query-builder-base.ts +213 -213
- package/src/query-builder/mssql/mssql-expr-renderer.ts +607 -607
- package/src/query-builder/mssql/mssql-query-builder.ts +650 -650
- package/src/query-builder/mysql/mysql-expr-renderer.ts +613 -613
- package/src/query-builder/mysql/mysql-query-builder.ts +759 -759
- package/src/query-builder/postgresql/postgresql-expr-renderer.ts +611 -611
- package/src/query-builder/postgresql/postgresql-query-builder.ts +686 -686
- package/src/query-builder/query-builder.ts +19 -19
- package/src/schema/factory/column-builder.ts +423 -423
- package/src/schema/factory/index-builder.ts +164 -164
- package/src/schema/factory/relation-builder.ts +453 -453
- package/src/schema/procedure-builder.ts +232 -232
- package/src/schema/table-builder.ts +319 -319
- package/src/schema/view-builder.ts +221 -221
- package/src/types/column.ts +188 -188
- package/src/types/db.ts +208 -208
- package/src/types/expr.ts +697 -697
- package/src/types/query-def.ts +513 -513
- package/src/utils/result-parser.ts +458 -458
- package/tests/db-context/create-db-context.spec.ts +224 -0
- package/tests/db-context/define-db-context.spec.ts +68 -0
- package/tests/ddl/basic.expected.ts +341 -0
- package/tests/ddl/basic.spec.ts +714 -0
- package/tests/ddl/column-builder.expected.ts +310 -0
- package/tests/ddl/column-builder.spec.ts +637 -0
- package/tests/ddl/index-builder.expected.ts +38 -0
- package/tests/ddl/index-builder.spec.ts +202 -0
- package/tests/ddl/procedure-builder.expected.ts +52 -0
- package/tests/ddl/procedure-builder.spec.ts +234 -0
- package/tests/ddl/relation-builder.expected.ts +36 -0
- package/tests/ddl/relation-builder.spec.ts +372 -0
- package/tests/ddl/table-builder.expected.ts +113 -0
- package/tests/ddl/table-builder.spec.ts +433 -0
- package/tests/ddl/view-builder.expected.ts +38 -0
- package/tests/ddl/view-builder.spec.ts +176 -0
- package/tests/dml/delete.expected.ts +96 -0
- package/tests/dml/delete.spec.ts +160 -0
- package/tests/dml/insert.expected.ts +192 -0
- package/tests/dml/insert.spec.ts +288 -0
- package/tests/dml/update.expected.ts +176 -0
- package/tests/dml/update.spec.ts +318 -0
- package/tests/dml/upsert.expected.ts +215 -0
- package/tests/dml/upsert.spec.ts +242 -0
- package/tests/errors/queryable-errors.spec.ts +177 -0
- package/tests/escape.spec.ts +100 -0
- package/tests/examples/pivot.expected.ts +211 -0
- package/tests/examples/pivot.spec.ts +533 -0
- package/tests/examples/sampling.expected.ts +69 -0
- package/tests/examples/sampling.spec.ts +104 -0
- package/tests/examples/unpivot.expected.ts +120 -0
- package/tests/examples/unpivot.spec.ts +226 -0
- package/tests/exec/search-parser.spec.ts +283 -0
- package/tests/executable/basic.expected.ts +18 -0
- package/tests/executable/basic.spec.ts +54 -0
- package/tests/expr/comparison.expected.ts +282 -0
- package/tests/expr/comparison.spec.ts +400 -0
- package/tests/expr/conditional.expected.ts +134 -0
- package/tests/expr/conditional.spec.ts +276 -0
- package/tests/expr/date.expected.ts +332 -0
- package/tests/expr/date.spec.ts +526 -0
- package/tests/expr/math.expected.ts +62 -0
- package/tests/expr/math.spec.ts +106 -0
- package/tests/expr/string.expected.ts +218 -0
- package/tests/expr/string.spec.ts +356 -0
- package/tests/expr/utility.expected.ts +147 -0
- package/tests/expr/utility.spec.ts +182 -0
- package/tests/select/basic.expected.ts +322 -0
- package/tests/select/basic.spec.ts +502 -0
- package/tests/select/filter.expected.ts +357 -0
- package/tests/select/filter.spec.ts +1068 -0
- package/tests/select/group.expected.ts +169 -0
- package/tests/select/group.spec.ts +244 -0
- package/tests/select/join.expected.ts +582 -0
- package/tests/select/join.spec.ts +805 -0
- package/tests/select/order.expected.ts +150 -0
- package/tests/select/order.spec.ts +189 -0
- package/tests/select/recursive-cte.expected.ts +244 -0
- package/tests/select/recursive-cte.spec.ts +514 -0
- package/tests/select/result-meta.spec.ts +270 -0
- package/tests/select/subquery.expected.ts +363 -0
- package/tests/select/subquery.spec.ts +537 -0
- package/tests/select/view.expected.ts +155 -0
- package/tests/select/view.spec.ts +235 -0
- package/tests/select/window.expected.ts +345 -0
- package/tests/select/window.spec.ts +618 -0
- package/tests/setup/MockExecutor.ts +18 -0
- package/tests/setup/TestDbContext.ts +59 -0
- package/tests/setup/models/Company.ts +13 -0
- package/tests/setup/models/Employee.ts +10 -0
- package/tests/setup/models/MonthlySales.ts +11 -0
- package/tests/setup/models/Post.ts +16 -0
- package/tests/setup/models/Sales.ts +10 -0
- package/tests/setup/models/User.ts +19 -0
- package/tests/setup/procedure/GetAllUsers.ts +9 -0
- package/tests/setup/procedure/GetUserById.ts +12 -0
- package/tests/setup/test-utils.ts +72 -0
- package/tests/setup/views/ActiveUsers.ts +8 -0
- package/tests/setup/views/UserSummary.ts +11 -0
- package/tests/types/nullable-queryable-record.spec.ts +145 -0
- package/tests/utils/result-parser-perf.spec.ts +210 -0
- package/tests/utils/result-parser.spec.ts +701 -0
- package/docs/expressions.md +0 -172
- package/docs/queries.md +0 -444
- package/docs/schema.md +0 -245
package/dist/expr/expr.d.ts
CHANGED
|
@@ -10,114 +10,114 @@ interface WinSpecInput {
|
|
|
10
10
|
orderBy?: [ExprInput<ColumnPrimitive>, ("ASC" | "DESC")?][];
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Switch
|
|
13
|
+
* Switch expression builder interface
|
|
14
14
|
*/
|
|
15
15
|
export interface SwitchExprBuilder<TPrimitive extends ColumnPrimitive> {
|
|
16
16
|
case(condition: WhereExprUnit, then: ExprInput<TPrimitive>): SwitchExprBuilder<TPrimitive>;
|
|
17
17
|
default(value: ExprInput<TPrimitive>): ExprUnit<TPrimitive>;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* Dialect
|
|
20
|
+
* Dialect-independent SQL expression builder
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* Generates JSON AST (Expr) instead of SQL strings, which QueryBuilder
|
|
23
|
+
* converts to each DBMS (MySQL, MSSQL, PostgreSQL)
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
26
26
|
* ```typescript
|
|
27
|
-
* // WHERE
|
|
27
|
+
* // WHERE condition
|
|
28
28
|
* db.user().where((u) => [
|
|
29
29
|
* expr.eq(u.status, "active"),
|
|
30
30
|
* expr.gt(u.age, 18),
|
|
31
31
|
* ])
|
|
32
32
|
*
|
|
33
|
-
* // SELECT
|
|
33
|
+
* // SELECT expression
|
|
34
34
|
* db.user().select((u) => ({
|
|
35
35
|
* name: expr.concat(u.firstName, " ", u.lastName),
|
|
36
36
|
* age: expr.dateDiff("year", u.birthDate, expr.val("DateOnly", DateOnly.today())),
|
|
37
37
|
* }))
|
|
38
38
|
*
|
|
39
|
-
* //
|
|
39
|
+
* // Aggregate function
|
|
40
40
|
* db.order().groupBy((o) => o.userId).select((o) => ({
|
|
41
41
|
* userId: o.userId,
|
|
42
42
|
* total: expr.sum(o.amount),
|
|
43
43
|
* }))
|
|
44
44
|
* ```
|
|
45
45
|
*
|
|
46
|
-
* @see {@link Queryable}
|
|
47
|
-
* @see {@link ExprUnit}
|
|
46
|
+
* @see {@link Queryable} Query builder class
|
|
47
|
+
* @see {@link ExprUnit} Expression wrapper class
|
|
48
48
|
*/
|
|
49
49
|
export declare const expr: {
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* Wrap literal value as ExprUnit
|
|
52
52
|
*
|
|
53
|
-
*
|
|
53
|
+
* Widen to base type matching dataType, remove literal type
|
|
54
54
|
*
|
|
55
|
-
* @param dataType -
|
|
56
|
-
* @param value - 래핑할
|
|
57
|
-
* @returns 래핑된 ExprUnit
|
|
55
|
+
* @param dataType - Value의 data type ("string", "number", "boolean", "DateTime", "DateOnly", "Time", "Uuid", "Buffer")
|
|
56
|
+
* @param value - 래핑할 value (undefined allow)
|
|
57
|
+
* @returns 래핑된 ExprUnit instance
|
|
58
58
|
*
|
|
59
59
|
* @example
|
|
60
60
|
* ```typescript
|
|
61
|
-
* //
|
|
61
|
+
* // String value
|
|
62
62
|
* expr.val("string", "active")
|
|
63
63
|
*
|
|
64
|
-
* //
|
|
64
|
+
* // Number value
|
|
65
65
|
* expr.val("number", 100)
|
|
66
66
|
*
|
|
67
|
-
* //
|
|
67
|
+
* // Date value
|
|
68
68
|
* expr.val("DateOnly", DateOnly.today())
|
|
69
69
|
*
|
|
70
|
-
* // undefined
|
|
70
|
+
* // undefined value
|
|
71
71
|
* expr.val("string", undefined)
|
|
72
72
|
* ```
|
|
73
73
|
*/
|
|
74
74
|
val<TStr extends ColumnPrimitiveStr, T extends ColumnPrimitiveMap[TStr] | undefined>(dataType: TStr, value: T): ExprUnit<T extends undefined ? ColumnPrimitiveMap[TStr] | undefined : ColumnPrimitiveMap[TStr]>;
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
* Generate column reference
|
|
77
77
|
*
|
|
78
|
-
*
|
|
78
|
+
* Typically proxy objects are used inside Queryable callbacks
|
|
79
79
|
*
|
|
80
|
-
* @param dataType -
|
|
81
|
-
* @param path -
|
|
82
|
-
* @returns
|
|
80
|
+
* @param dataType - Column data type
|
|
81
|
+
* @param path - Column path (table alias, column name, etc.)
|
|
82
|
+
* @returns Column reference ExprUnit instance
|
|
83
83
|
*
|
|
84
84
|
* @example
|
|
85
85
|
* ```typescript
|
|
86
|
-
* //
|
|
86
|
+
* // Direct column reference (internal use)
|
|
87
87
|
* expr.col("string", "T1", "name")
|
|
88
88
|
* ```
|
|
89
89
|
*/
|
|
90
90
|
col<TStr extends ColumnPrimitiveStr>(dataType: ColumnPrimitiveStr, ...path: string[]): ExprUnit<ColumnPrimitiveMap[TStr] | undefined>;
|
|
91
91
|
/**
|
|
92
|
-
* Raw SQL
|
|
92
|
+
* Raw SQL expression Generate (escape hatch)
|
|
93
93
|
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
94
|
+
* Use when you need to directly use DB-specific functions or syntax not supported by the ORM.
|
|
95
|
+
* Used as tagged template literal, interpolated values are automatically parameterized
|
|
96
96
|
*
|
|
97
|
-
* @param dataType -
|
|
98
|
-
* @returns
|
|
97
|
+
* @param dataType - Data type of the returned value
|
|
98
|
+
* @returns Tagged template function
|
|
99
99
|
*
|
|
100
100
|
* @example
|
|
101
101
|
* ```typescript
|
|
102
|
-
* // MySQL JSON
|
|
102
|
+
* // Using MySQL JSON function
|
|
103
103
|
* db.user().select((u) => ({
|
|
104
104
|
* name: u.name,
|
|
105
105
|
* data: expr.raw("string")`JSON_EXTRACT(${u.metadata}, '$.email')`,
|
|
106
106
|
* }))
|
|
107
107
|
*
|
|
108
|
-
* // PostgreSQL
|
|
108
|
+
* // PostgreSQL array function
|
|
109
109
|
* expr.raw("number")`ARRAY_LENGTH(${u.tags}, 1)`
|
|
110
110
|
* ```
|
|
111
111
|
*/
|
|
112
112
|
raw<T extends ColumnPrimitiveStr>(dataType: T): (strings: TemplateStringsArray, ...values: ExprInput<ColumnPrimitive>[]) => ExprUnit<ColumnPrimitiveMap[T] | undefined>;
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
114
|
+
* Equality comparison (NULL-safe)
|
|
115
115
|
*
|
|
116
|
-
*
|
|
116
|
+
* Safely compare even NULL values (MySQL: `<=>`, MSSQL/PostgreSQL: `IS NULL OR =`)
|
|
117
117
|
*
|
|
118
|
-
* @param source -
|
|
119
|
-
* @param target -
|
|
120
|
-
* @returns WHERE
|
|
118
|
+
* @param source - Column or expression to compare
|
|
119
|
+
* @param target - Target value or expression for comparison
|
|
120
|
+
* @returns WHERE condition expression
|
|
121
121
|
*
|
|
122
122
|
* @example
|
|
123
123
|
* ```typescript
|
|
@@ -127,11 +127,11 @@ export declare const expr: {
|
|
|
127
127
|
*/
|
|
128
128
|
eq<T extends ColumnPrimitive>(source: ExprUnit<T>, target: ExprInput<T>): WhereExprUnit;
|
|
129
129
|
/**
|
|
130
|
-
*
|
|
130
|
+
* Greater than comparison (>)
|
|
131
131
|
*
|
|
132
|
-
* @param source -
|
|
133
|
-
* @param target -
|
|
134
|
-
* @returns WHERE
|
|
132
|
+
* @param source - Column or expression to compare
|
|
133
|
+
* @param target - Target value or expression for comparison
|
|
134
|
+
* @returns WHERE condition expression
|
|
135
135
|
*
|
|
136
136
|
* @example
|
|
137
137
|
* ```typescript
|
|
@@ -141,11 +141,11 @@ export declare const expr: {
|
|
|
141
141
|
*/
|
|
142
142
|
gt<T extends ColumnPrimitive>(source: ExprUnit<T>, target: ExprInput<T>): WhereExprUnit;
|
|
143
143
|
/**
|
|
144
|
-
*
|
|
144
|
+
* Less than comparison (<)
|
|
145
145
|
*
|
|
146
|
-
* @param source -
|
|
147
|
-
* @param target -
|
|
148
|
-
* @returns WHERE
|
|
146
|
+
* @param source - Column or expression to compare
|
|
147
|
+
* @param target - Target value or expression for comparison
|
|
148
|
+
* @returns WHERE condition expression
|
|
149
149
|
*
|
|
150
150
|
* @example
|
|
151
151
|
* ```typescript
|
|
@@ -155,11 +155,11 @@ export declare const expr: {
|
|
|
155
155
|
*/
|
|
156
156
|
lt<T extends ColumnPrimitive>(source: ExprUnit<T>, target: ExprInput<T>): WhereExprUnit;
|
|
157
157
|
/**
|
|
158
|
-
*
|
|
158
|
+
* Greater than or equal comparison (>=)
|
|
159
159
|
*
|
|
160
|
-
* @param source -
|
|
161
|
-
* @param target -
|
|
162
|
-
* @returns WHERE
|
|
160
|
+
* @param source - Column or expression to compare
|
|
161
|
+
* @param target - Target value or expression for comparison
|
|
162
|
+
* @returns WHERE condition expression
|
|
163
163
|
*
|
|
164
164
|
* @example
|
|
165
165
|
* ```typescript
|
|
@@ -169,11 +169,11 @@ export declare const expr: {
|
|
|
169
169
|
*/
|
|
170
170
|
gte<T extends ColumnPrimitive>(source: ExprUnit<T>, target: ExprInput<T>): WhereExprUnit;
|
|
171
171
|
/**
|
|
172
|
-
*
|
|
172
|
+
* Less than or equal comparison (<=)
|
|
173
173
|
*
|
|
174
|
-
* @param source -
|
|
175
|
-
* @param target -
|
|
176
|
-
* @returns WHERE
|
|
174
|
+
* @param source - Column or expression to compare
|
|
175
|
+
* @param target - Target value or expression for comparison
|
|
176
|
+
* @returns WHERE condition expression
|
|
177
177
|
*
|
|
178
178
|
* @example
|
|
179
179
|
* ```typescript
|
|
@@ -183,22 +183,22 @@ export declare const expr: {
|
|
|
183
183
|
*/
|
|
184
184
|
lte<T extends ColumnPrimitive>(source: ExprUnit<T>, target: ExprInput<T>): WhereExprUnit;
|
|
185
185
|
/**
|
|
186
|
-
*
|
|
186
|
+
* range comparison (BETWEEN)
|
|
187
187
|
*
|
|
188
188
|
* from/to가 undefined이면 해당 방향은 무제한
|
|
189
189
|
*
|
|
190
|
-
* @param source -
|
|
191
|
-
* @param from -
|
|
192
|
-
* @param to - 끝
|
|
193
|
-
* @returns WHERE
|
|
190
|
+
* @param source - Column or expression to compare
|
|
191
|
+
* @param from - start value (undefined이면 하한 N/A)
|
|
192
|
+
* @param to - 끝 value (undefined이면 상한 N/A)
|
|
193
|
+
* @returns WHERE condition expression
|
|
194
194
|
*
|
|
195
195
|
* @example
|
|
196
196
|
* ```typescript
|
|
197
|
-
* //
|
|
197
|
+
* // range 지정
|
|
198
198
|
* db.user().where((u) => [expr.between(u.age, 18, 65)])
|
|
199
199
|
* // WHERE age BETWEEN 18 AND 65
|
|
200
200
|
*
|
|
201
|
-
* //
|
|
201
|
+
* // Specify only lower bound
|
|
202
202
|
* db.user().where((u) => [expr.between(u.age, 18, undefined)])
|
|
203
203
|
* // WHERE age >= 18
|
|
204
204
|
* ```
|
|
@@ -207,8 +207,8 @@ export declare const expr: {
|
|
|
207
207
|
/**
|
|
208
208
|
* NULL 체크 (IS NULL)
|
|
209
209
|
*
|
|
210
|
-
* @param source - 체크할
|
|
211
|
-
* @returns WHERE
|
|
210
|
+
* @param source - 체크할 column 또는 expression
|
|
211
|
+
* @returns WHERE condition expression
|
|
212
212
|
*
|
|
213
213
|
* @example
|
|
214
214
|
* ```typescript
|
|
@@ -218,14 +218,14 @@ export declare const expr: {
|
|
|
218
218
|
*/
|
|
219
219
|
null<T extends ColumnPrimitive>(source: ExprUnit<T>): WhereExprUnit;
|
|
220
220
|
/**
|
|
221
|
-
* LIKE
|
|
221
|
+
* LIKE pattern 매칭
|
|
222
222
|
*
|
|
223
223
|
* `%`는 0개 이상의 문자, `_`는 단일 문자와 매칭.
|
|
224
|
-
* 특수문자는 `\`로
|
|
224
|
+
* 특수문자는 `\`로 escape됨
|
|
225
225
|
*
|
|
226
|
-
* @param source - 검색할
|
|
227
|
-
* @param pattern - 검색
|
|
228
|
-
* @returns WHERE
|
|
226
|
+
* @param source - 검색할 column 또는 expression
|
|
227
|
+
* @param pattern - 검색 pattern (%, _ wildcard 사용 가능)
|
|
228
|
+
* @returns WHERE condition expression
|
|
229
229
|
*
|
|
230
230
|
* @example
|
|
231
231
|
* ```typescript
|
|
@@ -233,19 +233,19 @@ export declare const expr: {
|
|
|
233
233
|
* db.user().where((u) => [expr.like(u.name, "John%")])
|
|
234
234
|
* // WHERE name LIKE 'John%' ESCAPE '\'
|
|
235
235
|
*
|
|
236
|
-
* //
|
|
236
|
+
* // include 검색
|
|
237
237
|
* db.user().where((u) => [expr.like(u.email, "%@gmail.com")])
|
|
238
238
|
* ```
|
|
239
239
|
*/
|
|
240
240
|
like(source: ExprUnit<string | undefined>, pattern: ExprInput<string | undefined>): WhereExprUnit;
|
|
241
241
|
/**
|
|
242
|
-
*
|
|
242
|
+
* regular expression pattern 매칭
|
|
243
243
|
*
|
|
244
|
-
* DBMS별
|
|
244
|
+
* DBMS별 regular expression 문법 차이 주의 필요
|
|
245
245
|
*
|
|
246
|
-
* @param source - 검색할
|
|
247
|
-
* @param pattern -
|
|
248
|
-
* @returns WHERE
|
|
246
|
+
* @param source - 검색할 column 또는 expression
|
|
247
|
+
* @param pattern - regular expression pattern
|
|
248
|
+
* @returns WHERE condition expression
|
|
249
249
|
*
|
|
250
250
|
* @example
|
|
251
251
|
* ```typescript
|
|
@@ -255,11 +255,11 @@ export declare const expr: {
|
|
|
255
255
|
*/
|
|
256
256
|
regexp(source: ExprUnit<string | undefined>, pattern: ExprInput<string | undefined>): WhereExprUnit;
|
|
257
257
|
/**
|
|
258
|
-
* IN
|
|
258
|
+
* IN operator - Value 목록과 comparison
|
|
259
259
|
*
|
|
260
|
-
* @param source -
|
|
261
|
-
* @param values - 비교할
|
|
262
|
-
* @returns WHERE
|
|
260
|
+
* @param source - Column or expression to compare
|
|
261
|
+
* @param values - 비교할 value 목록
|
|
262
|
+
* @returns WHERE condition expression
|
|
263
263
|
*
|
|
264
264
|
* @example
|
|
265
265
|
* ```typescript
|
|
@@ -269,14 +269,14 @@ export declare const expr: {
|
|
|
269
269
|
*/
|
|
270
270
|
in<T extends ColumnPrimitive>(source: ExprUnit<T>, values: ExprInput<T>[]): WhereExprUnit;
|
|
271
271
|
/**
|
|
272
|
-
* IN (SELECT ...) -
|
|
272
|
+
* IN (SELECT ...) - Subquery 결과와 comparison
|
|
273
273
|
*
|
|
274
|
-
*
|
|
274
|
+
* Subquery는 반드시 단일 column만 SELECT해야 함
|
|
275
275
|
*
|
|
276
|
-
* @param source -
|
|
277
|
-
* @param query - 단일
|
|
278
|
-
* @returns WHERE
|
|
279
|
-
* @throws {Error}
|
|
276
|
+
* @param source - Column or expression to compare
|
|
277
|
+
* @param query - 단일 column을 반환하는 Queryable
|
|
278
|
+
* @returns WHERE condition expression
|
|
279
|
+
* @throws {Error} Subquery가 단일 column이 아닌 경우
|
|
280
280
|
*
|
|
281
281
|
* @example
|
|
282
282
|
* ```typescript
|
|
@@ -293,12 +293,12 @@ export declare const expr: {
|
|
|
293
293
|
*/
|
|
294
294
|
inQuery<T extends ColumnPrimitive, TData extends Record<string, T>>(source: ExprUnit<T>, query: Queryable<TData, any>): WhereExprUnit;
|
|
295
295
|
/**
|
|
296
|
-
* EXISTS (SELECT ...) -
|
|
296
|
+
* EXISTS (SELECT ...) - Subquery result 존재 여부 확인
|
|
297
297
|
*
|
|
298
|
-
*
|
|
298
|
+
* Subquery가 하나 이상의 행을 반환하면 true
|
|
299
299
|
*
|
|
300
300
|
* @param query - 존재 여부를 확인할 Queryable
|
|
301
|
-
* @returns WHERE
|
|
301
|
+
* @returns WHERE condition expression
|
|
302
302
|
*
|
|
303
303
|
* @example
|
|
304
304
|
* ```typescript
|
|
@@ -313,10 +313,10 @@ export declare const expr: {
|
|
|
313
313
|
*/
|
|
314
314
|
exists(query: Queryable<any, any>): WhereExprUnit;
|
|
315
315
|
/**
|
|
316
|
-
* NOT
|
|
316
|
+
* NOT operator - Condition 부정
|
|
317
317
|
*
|
|
318
|
-
* @param arg - 부정할
|
|
319
|
-
* @returns 부정된 WHERE
|
|
318
|
+
* @param arg - 부정할 condition
|
|
319
|
+
* @returns 부정된 WHERE condition expression
|
|
320
320
|
*
|
|
321
321
|
* @example
|
|
322
322
|
* ```typescript
|
|
@@ -326,12 +326,12 @@ export declare const expr: {
|
|
|
326
326
|
*/
|
|
327
327
|
not(arg: WhereExprUnit): WhereExprUnit;
|
|
328
328
|
/**
|
|
329
|
-
* AND
|
|
329
|
+
* AND operator - 모든 condition 충족
|
|
330
330
|
*
|
|
331
|
-
* 여러 조건을 AND로 결합. where() 메서드에 배열로 전달하면
|
|
331
|
+
* 여러 조건을 AND로 결합. where() 메서드에 배열로 전달하면 automatic으로 AND applied
|
|
332
332
|
*
|
|
333
|
-
* @param conditions - AND로 결합할
|
|
334
|
-
* @returns 결합된 WHERE
|
|
333
|
+
* @param conditions - AND로 결합할 condition 목록
|
|
334
|
+
* @returns 결합된 WHERE condition expression
|
|
335
335
|
*
|
|
336
336
|
* @example
|
|
337
337
|
* ```typescript
|
|
@@ -346,10 +346,10 @@ export declare const expr: {
|
|
|
346
346
|
*/
|
|
347
347
|
and(conditions: WhereExprUnit[]): WhereExprUnit;
|
|
348
348
|
/**
|
|
349
|
-
* OR
|
|
349
|
+
* OR operator - 하나 이상의 condition 충족
|
|
350
350
|
*
|
|
351
|
-
* @param conditions - OR로 결합할
|
|
352
|
-
* @returns 결합된 WHERE
|
|
351
|
+
* @param conditions - OR로 결합할 condition 목록
|
|
352
|
+
* @returns 결합된 WHERE condition expression
|
|
353
353
|
*
|
|
354
354
|
* @example
|
|
355
355
|
* ```typescript
|
|
@@ -366,10 +366,10 @@ export declare const expr: {
|
|
|
366
366
|
/**
|
|
367
367
|
* 문자열 연결 (CONCAT)
|
|
368
368
|
*
|
|
369
|
-
* NULL 값은 빈 문자열로
|
|
369
|
+
* NULL 값은 빈 문자열로 processing됨 (DBMS별 automatic Transform)
|
|
370
370
|
*
|
|
371
371
|
* @param args - 연결할 문자열들
|
|
372
|
-
* @returns 연결된 문자열
|
|
372
|
+
* @returns 연결된 문자열 expression
|
|
373
373
|
*
|
|
374
374
|
* @example
|
|
375
375
|
* ```typescript
|
|
@@ -383,9 +383,9 @@ export declare const expr: {
|
|
|
383
383
|
/**
|
|
384
384
|
* 문자열 왼쪽에서 지정 길이만큼 추출 (LEFT)
|
|
385
385
|
*
|
|
386
|
-
* @param source -
|
|
386
|
+
* @param source - original string
|
|
387
387
|
* @param length - 추출할 문자 수
|
|
388
|
-
* @returns 추출된 문자열
|
|
388
|
+
* @returns 추출된 문자열 expression
|
|
389
389
|
*
|
|
390
390
|
* @example
|
|
391
391
|
* ```typescript
|
|
@@ -399,9 +399,9 @@ export declare const expr: {
|
|
|
399
399
|
/**
|
|
400
400
|
* 문자열 오른쪽에서 지정 길이만큼 추출 (RIGHT)
|
|
401
401
|
*
|
|
402
|
-
* @param source -
|
|
402
|
+
* @param source - original string
|
|
403
403
|
* @param length - 추출할 문자 수
|
|
404
|
-
* @returns 추출된 문자열
|
|
404
|
+
* @returns 추출된 문자열 expression
|
|
405
405
|
*
|
|
406
406
|
* @example
|
|
407
407
|
* ```typescript
|
|
@@ -413,10 +413,10 @@ export declare const expr: {
|
|
|
413
413
|
*/
|
|
414
414
|
right<T extends string | undefined>(source: ExprUnit<T>, length: ExprInput<number>): ExprUnit<T>;
|
|
415
415
|
/**
|
|
416
|
-
* 문자열 양쪽 공백
|
|
416
|
+
* 문자열 양쪽 공백 Remove (TRIM)
|
|
417
417
|
*
|
|
418
|
-
* @param source -
|
|
419
|
-
* @returns 공백이 제거된 문자열
|
|
418
|
+
* @param source - original string
|
|
419
|
+
* @returns 공백이 제거된 문자열 expression
|
|
420
420
|
*
|
|
421
421
|
* @example
|
|
422
422
|
* ```typescript
|
|
@@ -430,12 +430,12 @@ export declare const expr: {
|
|
|
430
430
|
/**
|
|
431
431
|
* 문자열 왼쪽 패딩 (LPAD)
|
|
432
432
|
*
|
|
433
|
-
* 지정 길이가 될 때까지 왼쪽에 fillString
|
|
433
|
+
* 지정 길이가 될 때까지 왼쪽에 fillString loop Add
|
|
434
434
|
*
|
|
435
|
-
* @param source -
|
|
435
|
+
* @param source - original string
|
|
436
436
|
* @param length - 목표 길이
|
|
437
437
|
* @param fillString - 패딩에 사용할 문자열
|
|
438
|
-
* @returns 패딩된 문자열
|
|
438
|
+
* @returns 패딩된 문자열 expression
|
|
439
439
|
*
|
|
440
440
|
* @example
|
|
441
441
|
* ```typescript
|
|
@@ -443,17 +443,17 @@ export declare const expr: {
|
|
|
443
443
|
* orderNo: expr.padStart(expr.cast(o.id, { type: "varchar", length: 10 }), 8, "0"),
|
|
444
444
|
* }))
|
|
445
445
|
* // SELECT LPAD(CAST(id AS VARCHAR(10)), 8, '0') AS orderNo
|
|
446
|
-
* //
|
|
446
|
+
* // Result: "00000123"
|
|
447
447
|
* ```
|
|
448
448
|
*/
|
|
449
449
|
padStart<T extends string | undefined>(source: ExprUnit<T>, length: ExprInput<number>, fillString: ExprInput<string>): ExprUnit<T>;
|
|
450
450
|
/**
|
|
451
451
|
* 문자열 치환 (REPLACE)
|
|
452
452
|
*
|
|
453
|
-
* @param source -
|
|
453
|
+
* @param source - original string
|
|
454
454
|
* @param from - 찾을 문자열
|
|
455
455
|
* @param to - 대체할 문자열
|
|
456
|
-
* @returns 치환된 문자열
|
|
456
|
+
* @returns 치환된 문자열 expression
|
|
457
457
|
*
|
|
458
458
|
* @example
|
|
459
459
|
* ```typescript
|
|
@@ -465,10 +465,10 @@ export declare const expr: {
|
|
|
465
465
|
*/
|
|
466
466
|
replace<T extends string | undefined>(source: ExprUnit<T>, from: ExprInput<string>, to: ExprInput<string>): ExprUnit<T>;
|
|
467
467
|
/**
|
|
468
|
-
* 문자열 대문자
|
|
468
|
+
* 문자열 대문자 Transform (UPPER)
|
|
469
469
|
*
|
|
470
|
-
* @param source -
|
|
471
|
-
* @returns 대문자로
|
|
470
|
+
* @param source - original string
|
|
471
|
+
* @returns 대문자로 Transform된 문자열 expression
|
|
472
472
|
*
|
|
473
473
|
* @example
|
|
474
474
|
* ```typescript
|
|
@@ -480,10 +480,10 @@ export declare const expr: {
|
|
|
480
480
|
*/
|
|
481
481
|
upper<T extends string | undefined>(source: ExprUnit<T>): ExprUnit<T>;
|
|
482
482
|
/**
|
|
483
|
-
* 문자열 소문자
|
|
483
|
+
* 문자열 소문자 Transform (LOWER)
|
|
484
484
|
*
|
|
485
|
-
* @param source -
|
|
486
|
-
* @returns 소문자로
|
|
485
|
+
* @param source - original string
|
|
486
|
+
* @returns 소문자로 Transform된 문자열 expression
|
|
487
487
|
*
|
|
488
488
|
* @example
|
|
489
489
|
* ```typescript
|
|
@@ -497,7 +497,7 @@ export declare const expr: {
|
|
|
497
497
|
/**
|
|
498
498
|
* 문자열 길이 (문자 수)
|
|
499
499
|
*
|
|
500
|
-
* @param source -
|
|
500
|
+
* @param source - original string
|
|
501
501
|
* @returns 문자 수
|
|
502
502
|
*
|
|
503
503
|
* @example
|
|
@@ -514,7 +514,7 @@ export declare const expr: {
|
|
|
514
514
|
*
|
|
515
515
|
* UTF-8 환경에서 한글은 3바이트
|
|
516
516
|
*
|
|
517
|
-
* @param source -
|
|
517
|
+
* @param source - original string
|
|
518
518
|
* @returns 바이트 수
|
|
519
519
|
*
|
|
520
520
|
* @example
|
|
@@ -531,15 +531,15 @@ export declare const expr: {
|
|
|
531
531
|
*
|
|
532
532
|
* SQL 표준에 따라 1-based index 사용
|
|
533
533
|
*
|
|
534
|
-
* @param source -
|
|
535
|
-
* @param start -
|
|
534
|
+
* @param source - original string
|
|
535
|
+
* @param start - start 위치 (1부터 start)
|
|
536
536
|
* @param length - 추출할 길이 (생략 시 끝까지)
|
|
537
|
-
* @returns 추출된 문자열
|
|
537
|
+
* @returns 추출된 문자열 expression
|
|
538
538
|
*
|
|
539
539
|
* @example
|
|
540
540
|
* ```typescript
|
|
541
541
|
* db.user().select((u) => ({
|
|
542
|
-
* // "Hello World"에서
|
|
542
|
+
* // "Hello World"에서 Index 1부터 5글자: "Hello"
|
|
543
543
|
* prefix: expr.substring(u.name, 1, 5),
|
|
544
544
|
* }))
|
|
545
545
|
* // SELECT SUBSTRING(name, 1, 5) AS prefix
|
|
@@ -549,11 +549,11 @@ export declare const expr: {
|
|
|
549
549
|
/**
|
|
550
550
|
* 문자열 내 위치 찾기 (LOCATE/CHARINDEX)
|
|
551
551
|
*
|
|
552
|
-
* 1-based index
|
|
552
|
+
* 1-based index return, 없으면 0 return
|
|
553
553
|
*
|
|
554
554
|
* @param source - 검색할 문자열
|
|
555
555
|
* @param search - 찾을 문자열
|
|
556
|
-
* @returns 위치 (1부터
|
|
556
|
+
* @returns 위치 (1부터 start, 없으면 0)
|
|
557
557
|
*
|
|
558
558
|
* @example
|
|
559
559
|
* ```typescript
|
|
@@ -568,8 +568,8 @@ export declare const expr: {
|
|
|
568
568
|
/**
|
|
569
569
|
* 절대값 (ABS)
|
|
570
570
|
*
|
|
571
|
-
* @param source - 원본
|
|
572
|
-
* @returns 절대값
|
|
571
|
+
* @param source - 원본 Number
|
|
572
|
+
* @returns 절대값 expression
|
|
573
573
|
*
|
|
574
574
|
* @example
|
|
575
575
|
* ```typescript
|
|
@@ -583,9 +583,9 @@ export declare const expr: {
|
|
|
583
583
|
/**
|
|
584
584
|
* 반올림 (ROUND)
|
|
585
585
|
*
|
|
586
|
-
* @param source - 원본
|
|
586
|
+
* @param source - 원본 Number
|
|
587
587
|
* @param digits - 소수점 이하 자릿수
|
|
588
|
-
* @returns 반올림된
|
|
588
|
+
* @returns 반올림된 Number expression
|
|
589
589
|
*
|
|
590
590
|
* @example
|
|
591
591
|
* ```typescript
|
|
@@ -600,8 +600,8 @@ export declare const expr: {
|
|
|
600
600
|
/**
|
|
601
601
|
* 올림 (CEILING)
|
|
602
602
|
*
|
|
603
|
-
* @param source - 원본
|
|
604
|
-
* @returns 올림된
|
|
603
|
+
* @param source - 원본 Number
|
|
604
|
+
* @returns 올림된 Number expression
|
|
605
605
|
*
|
|
606
606
|
* @example
|
|
607
607
|
* ```typescript
|
|
@@ -616,8 +616,8 @@ export declare const expr: {
|
|
|
616
616
|
/**
|
|
617
617
|
* 버림 (FLOOR)
|
|
618
618
|
*
|
|
619
|
-
* @param source - 원본
|
|
620
|
-
* @returns 버림된
|
|
619
|
+
* @param source - 원본 Number
|
|
620
|
+
* @returns 버림된 Number expression
|
|
621
621
|
*
|
|
622
622
|
* @example
|
|
623
623
|
* ```typescript
|
|
@@ -632,8 +632,8 @@ export declare const expr: {
|
|
|
632
632
|
/**
|
|
633
633
|
* 연도 추출 (YEAR)
|
|
634
634
|
*
|
|
635
|
-
* @param source - DateTime 또는 DateOnly
|
|
636
|
-
* @returns 연도 (4자리
|
|
635
|
+
* @param source - DateTime 또는 DateOnly expression
|
|
636
|
+
* @returns 연도 (4자리 Number)
|
|
637
637
|
*
|
|
638
638
|
* @example
|
|
639
639
|
* ```typescript
|
|
@@ -647,7 +647,7 @@ export declare const expr: {
|
|
|
647
647
|
/**
|
|
648
648
|
* 월 추출 (MONTH)
|
|
649
649
|
*
|
|
650
|
-
* @param source - DateTime 또는 DateOnly
|
|
650
|
+
* @param source - DateTime 또는 DateOnly expression
|
|
651
651
|
* @returns 월 (1~12)
|
|
652
652
|
*
|
|
653
653
|
* @example
|
|
@@ -662,7 +662,7 @@ export declare const expr: {
|
|
|
662
662
|
/**
|
|
663
663
|
* 일 추출 (DAY)
|
|
664
664
|
*
|
|
665
|
-
* @param source - DateTime 또는 DateOnly
|
|
665
|
+
* @param source - DateTime 또는 DateOnly expression
|
|
666
666
|
* @returns 일 (1~31)
|
|
667
667
|
*
|
|
668
668
|
* @example
|
|
@@ -677,7 +677,7 @@ export declare const expr: {
|
|
|
677
677
|
/**
|
|
678
678
|
* 시 추출 (HOUR)
|
|
679
679
|
*
|
|
680
|
-
* @param source - DateTime 또는 Time
|
|
680
|
+
* @param source - DateTime 또는 Time expression
|
|
681
681
|
* @returns 시 (0~23)
|
|
682
682
|
*
|
|
683
683
|
* @example
|
|
@@ -692,7 +692,7 @@ export declare const expr: {
|
|
|
692
692
|
/**
|
|
693
693
|
* 분 추출 (MINUTE)
|
|
694
694
|
*
|
|
695
|
-
* @param source - DateTime 또는 Time
|
|
695
|
+
* @param source - DateTime 또는 Time expression
|
|
696
696
|
* @returns 분 (0~59)
|
|
697
697
|
*
|
|
698
698
|
* @example
|
|
@@ -707,7 +707,7 @@ export declare const expr: {
|
|
|
707
707
|
/**
|
|
708
708
|
* 초 추출 (SECOND)
|
|
709
709
|
*
|
|
710
|
-
* @param source - DateTime 또는 Time
|
|
710
|
+
* @param source - DateTime 또는 Time expression
|
|
711
711
|
* @returns 초 (0~59)
|
|
712
712
|
*
|
|
713
713
|
* @example
|
|
@@ -722,9 +722,9 @@ export declare const expr: {
|
|
|
722
722
|
/**
|
|
723
723
|
* ISO 주차 추출
|
|
724
724
|
*
|
|
725
|
-
* ISO 8601 기준 주차 (월요일
|
|
725
|
+
* ISO 8601 기준 주차 (월요일 start, 1~53)
|
|
726
726
|
*
|
|
727
|
-
* @param source - DateOnly
|
|
727
|
+
* @param source - DateOnly expression
|
|
728
728
|
* @returns ISO 주차 번호
|
|
729
729
|
*
|
|
730
730
|
* @example
|
|
@@ -739,10 +739,10 @@ export declare const expr: {
|
|
|
739
739
|
/**
|
|
740
740
|
* ISO 주 시작일 (월요일)
|
|
741
741
|
*
|
|
742
|
-
* 해당
|
|
742
|
+
* 해당 Date가 속한 주의 월요일 return
|
|
743
743
|
*
|
|
744
|
-
* @param source - DateOnly
|
|
745
|
-
* @returns 주의
|
|
744
|
+
* @param source - DateOnly expression
|
|
745
|
+
* @returns 주의 start Date (월요일)
|
|
746
746
|
*
|
|
747
747
|
* @example
|
|
748
748
|
* ```typescript
|
|
@@ -756,9 +756,9 @@ export declare const expr: {
|
|
|
756
756
|
/**
|
|
757
757
|
* ISO 연월 (해당 월의 1일)
|
|
758
758
|
*
|
|
759
|
-
* 해당
|
|
759
|
+
* 해당 Date의 월 첫째 날 return
|
|
760
760
|
*
|
|
761
|
-
* @param source - DateOnly
|
|
761
|
+
* @param source - DateOnly expression
|
|
762
762
|
* @returns 월의 첫째 날
|
|
763
763
|
*
|
|
764
764
|
* @example
|
|
@@ -771,12 +771,12 @@ export declare const expr: {
|
|
|
771
771
|
*/
|
|
772
772
|
isoYearMonth<T extends DateOnly | undefined>(source: ExprUnit<T>): ExprUnit<T>;
|
|
773
773
|
/**
|
|
774
|
-
*
|
|
774
|
+
* Date 차이 계산 (DATEDIFF)
|
|
775
775
|
*
|
|
776
776
|
* @param separator - 단위 ("year", "month", "day", "hour", "minute", "second")
|
|
777
|
-
* @param from -
|
|
778
|
-
* @param to - 끝
|
|
779
|
-
* @returns 차이
|
|
777
|
+
* @param from - start Date
|
|
778
|
+
* @param to - 끝 Date
|
|
779
|
+
* @returns 차이 value (to - from)
|
|
780
780
|
*
|
|
781
781
|
* @example
|
|
782
782
|
* ```typescript
|
|
@@ -788,12 +788,12 @@ export declare const expr: {
|
|
|
788
788
|
*/
|
|
789
789
|
dateDiff<T extends DateTime | DateOnly | Time | undefined>(separator: DateSeparator, from: ExprInput<T>, to: ExprInput<T>): ExprUnit<T extends undefined ? undefined : number>;
|
|
790
790
|
/**
|
|
791
|
-
*
|
|
791
|
+
* Date 더하기 (DATEADD)
|
|
792
792
|
*
|
|
793
793
|
* @param separator - 단위 ("year", "month", "day", "hour", "minute", "second")
|
|
794
|
-
* @param source - 원본
|
|
795
|
-
* @param value - 더할
|
|
796
|
-
* @returns 계산된
|
|
794
|
+
* @param source - 원본 Date
|
|
795
|
+
* @param value - 더할 value (음수 가능)
|
|
796
|
+
* @returns 계산된 Date
|
|
797
797
|
*
|
|
798
798
|
* @example
|
|
799
799
|
* ```typescript
|
|
@@ -805,13 +805,13 @@ export declare const expr: {
|
|
|
805
805
|
*/
|
|
806
806
|
dateAdd<T extends DateTime | DateOnly | Time | undefined>(separator: DateSeparator, source: ExprUnit<T>, value: ExprInput<number>): ExprUnit<T>;
|
|
807
807
|
/**
|
|
808
|
-
*
|
|
808
|
+
* Date 포맷 (DATE_FORMAT)
|
|
809
809
|
*
|
|
810
810
|
* DBMS별로 포맷 문자열 규칙이 다를 수 있음
|
|
811
811
|
*
|
|
812
|
-
* @param source -
|
|
812
|
+
* @param source - Date expression
|
|
813
813
|
* @param format - 포맷 문자열 (예: "%Y-%m-%d")
|
|
814
|
-
* @returns 포맷된 문자열
|
|
814
|
+
* @returns 포맷된 문자열 expression
|
|
815
815
|
*
|
|
816
816
|
* @example
|
|
817
817
|
* ```typescript
|
|
@@ -826,10 +826,10 @@ export declare const expr: {
|
|
|
826
826
|
/**
|
|
827
827
|
* NULL 대체 (COALESCE/IFNULL)
|
|
828
828
|
*
|
|
829
|
-
* 첫 번째 non-null 값을
|
|
829
|
+
* 첫 번째 non-null 값을 return. 마지막 인자가 non-nullable이면 결과도 non-nullable
|
|
830
830
|
*
|
|
831
|
-
* @param args -
|
|
832
|
-
* @returns 첫 번째 non-null
|
|
831
|
+
* @param args - Inspect할 값들 (마지막은 Default value)
|
|
832
|
+
* @returns 첫 번째 non-null value
|
|
833
833
|
*
|
|
834
834
|
* @example
|
|
835
835
|
* ```typescript
|
|
@@ -841,18 +841,18 @@ export declare const expr: {
|
|
|
841
841
|
*/
|
|
842
842
|
ifNull: typeof ifNull;
|
|
843
843
|
/**
|
|
844
|
-
* 특정 값이면 NULL
|
|
844
|
+
* 특정 값이면 NULL return (NULLIF)
|
|
845
845
|
*
|
|
846
|
-
* source === value 이면 NULL
|
|
846
|
+
* source === value 이면 NULL return, 아니면 source return
|
|
847
847
|
*
|
|
848
|
-
* @param source - 원본
|
|
849
|
-
* @param value - 비교할
|
|
850
|
-
* @returns NULL 또는 원본
|
|
848
|
+
* @param source - 원본 value
|
|
849
|
+
* @param value - 비교할 value
|
|
850
|
+
* @returns NULL 또는 원본 value
|
|
851
851
|
*
|
|
852
852
|
* @example
|
|
853
853
|
* ```typescript
|
|
854
854
|
* db.user().select((u) => ({
|
|
855
|
-
* // 빈 문자열을 NULL로
|
|
855
|
+
* // 빈 문자열을 NULL로 Transform
|
|
856
856
|
* bio: expr.nullIf(u.bio, ""),
|
|
857
857
|
* }))
|
|
858
858
|
* // SELECT NULLIF(bio, '') AS bio
|
|
@@ -860,12 +860,12 @@ export declare const expr: {
|
|
|
860
860
|
*/
|
|
861
861
|
nullIf<T extends ColumnPrimitive>(source: ExprUnit<T>, value: ExprInput<T>): ExprUnit<T | undefined>;
|
|
862
862
|
/**
|
|
863
|
-
* WHERE 표현식을 boolean으로
|
|
863
|
+
* WHERE 표현식을 boolean으로 Transform
|
|
864
864
|
*
|
|
865
|
-
* SELECT 절에서
|
|
865
|
+
* SELECT 절에서 condition 결과를 boolean column으로 사용할 때 사용
|
|
866
866
|
*
|
|
867
|
-
* @param condition -
|
|
868
|
-
* @returns boolean
|
|
867
|
+
* @param condition - Transform할 condition
|
|
868
|
+
* @returns boolean expression
|
|
869
869
|
*
|
|
870
870
|
* @example
|
|
871
871
|
* ```typescript
|
|
@@ -877,11 +877,11 @@ export declare const expr: {
|
|
|
877
877
|
*/
|
|
878
878
|
is(condition: WhereExprUnit): ExprUnit<boolean>;
|
|
879
879
|
/**
|
|
880
|
-
* CASE WHEN
|
|
880
|
+
* CASE WHEN expression builder
|
|
881
881
|
*
|
|
882
|
-
* 체이닝 방식으로
|
|
882
|
+
* 체이닝 방식으로 condition 분기를 구성
|
|
883
883
|
*
|
|
884
|
-
* @returns SwitchExprBuilder
|
|
884
|
+
* @returns SwitchExprBuilder instance
|
|
885
885
|
*
|
|
886
886
|
* @example
|
|
887
887
|
* ```typescript
|
|
@@ -897,12 +897,12 @@ export declare const expr: {
|
|
|
897
897
|
*/
|
|
898
898
|
switch<T extends ColumnPrimitive>(): SwitchExprBuilder<T>;
|
|
899
899
|
/**
|
|
900
|
-
* 단순 IF
|
|
900
|
+
* 단순 IF condition (삼항 operator)
|
|
901
901
|
*
|
|
902
|
-
* @param condition -
|
|
903
|
-
* @param then -
|
|
904
|
-
* @param else_ -
|
|
905
|
-
* @returns 조건부
|
|
902
|
+
* @param condition - Condition
|
|
903
|
+
* @param then - Condition이 참일 때 value
|
|
904
|
+
* @param else_ - Condition이 거짓일 때 value
|
|
905
|
+
* @returns 조건부 value expression
|
|
906
906
|
*
|
|
907
907
|
* @example
|
|
908
908
|
* ```typescript
|
|
@@ -914,18 +914,18 @@ export declare const expr: {
|
|
|
914
914
|
*/
|
|
915
915
|
if<T extends ColumnPrimitive>(condition: WhereExprUnit, then: ExprInput<T>, else_: ExprInput<T>): ExprUnit<T>;
|
|
916
916
|
/**
|
|
917
|
-
*
|
|
917
|
+
* row 수 카운트 (COUNT)
|
|
918
918
|
*
|
|
919
|
-
* @param arg - 카운트할
|
|
920
|
-
* @param distinct - true면 중복
|
|
921
|
-
* @returns
|
|
919
|
+
* @param arg - 카운트할 column (생략 시 전체 row 수)
|
|
920
|
+
* @param distinct - true면 중복 Remove
|
|
921
|
+
* @returns row 수
|
|
922
922
|
*
|
|
923
923
|
* @example
|
|
924
924
|
* ```typescript
|
|
925
|
-
* // 전체
|
|
925
|
+
* // 전체 row 수
|
|
926
926
|
* db.user().select(() => ({ total: expr.count() }))
|
|
927
927
|
*
|
|
928
|
-
* // 중복
|
|
928
|
+
* // 중복 Remove 카운트
|
|
929
929
|
* db.order().select((o) => ({
|
|
930
930
|
* uniqueCustomers: expr.count(o.customerId, true),
|
|
931
931
|
* }))
|
|
@@ -935,9 +935,9 @@ export declare const expr: {
|
|
|
935
935
|
/**
|
|
936
936
|
* 합계 (SUM)
|
|
937
937
|
*
|
|
938
|
-
* NULL 값은 무시됨. 모든 값이 NULL이면 NULL
|
|
938
|
+
* NULL 값은 무시됨. 모든 값이 NULL이면 NULL return
|
|
939
939
|
*
|
|
940
|
-
* @param arg - 합계를 구할
|
|
940
|
+
* @param arg - 합계를 구할 Number column
|
|
941
941
|
* @returns 합계 (또는 NULL)
|
|
942
942
|
*
|
|
943
943
|
* @example
|
|
@@ -952,9 +952,9 @@ export declare const expr: {
|
|
|
952
952
|
/**
|
|
953
953
|
* 평균 (AVG)
|
|
954
954
|
*
|
|
955
|
-
* NULL 값은 무시됨. 모든 값이 NULL이면 NULL
|
|
955
|
+
* NULL 값은 무시됨. 모든 값이 NULL이면 NULL return
|
|
956
956
|
*
|
|
957
|
-
* @param arg - 평균을 구할
|
|
957
|
+
* @param arg - 평균을 구할 Number column
|
|
958
958
|
* @returns 평균 (또는 NULL)
|
|
959
959
|
*
|
|
960
960
|
* @example
|
|
@@ -969,9 +969,9 @@ export declare const expr: {
|
|
|
969
969
|
/**
|
|
970
970
|
* 최대값 (MAX)
|
|
971
971
|
*
|
|
972
|
-
* NULL 값은 무시됨. 모든 값이 NULL이면 NULL
|
|
972
|
+
* NULL 값은 무시됨. 모든 값이 NULL이면 NULL return
|
|
973
973
|
*
|
|
974
|
-
* @param arg - 최대값을 구할
|
|
974
|
+
* @param arg - 최대값을 구할 column
|
|
975
975
|
* @returns 최대값 (또는 NULL)
|
|
976
976
|
*
|
|
977
977
|
* @example
|
|
@@ -986,9 +986,9 @@ export declare const expr: {
|
|
|
986
986
|
/**
|
|
987
987
|
* 최소값 (MIN)
|
|
988
988
|
*
|
|
989
|
-
* NULL 값은 무시됨. 모든 값이 NULL이면 NULL
|
|
989
|
+
* NULL 값은 무시됨. 모든 값이 NULL이면 NULL return
|
|
990
990
|
*
|
|
991
|
-
* @param arg - 최소값을 구할
|
|
991
|
+
* @param arg - 최소값을 구할 column
|
|
992
992
|
* @returns 최소값 (또는 NULL)
|
|
993
993
|
*
|
|
994
994
|
* @example
|
|
@@ -1001,7 +1001,7 @@ export declare const expr: {
|
|
|
1001
1001
|
*/
|
|
1002
1002
|
min<T extends ColumnPrimitive>(arg: ExprUnit<T>): ExprUnit<T | undefined>;
|
|
1003
1003
|
/**
|
|
1004
|
-
* 여러
|
|
1004
|
+
* 여러 value 중 최대값 (GREATEST)
|
|
1005
1005
|
*
|
|
1006
1006
|
* @param args - 비교할 값들
|
|
1007
1007
|
* @returns 최대값
|
|
@@ -1016,7 +1016,7 @@ export declare const expr: {
|
|
|
1016
1016
|
*/
|
|
1017
1017
|
greatest<T extends ColumnPrimitive>(...args: ExprInput<T>[]): ExprUnit<T>;
|
|
1018
1018
|
/**
|
|
1019
|
-
* 여러
|
|
1019
|
+
* 여러 value 중 최소값 (LEAST)
|
|
1020
1020
|
*
|
|
1021
1021
|
* @param args - 비교할 값들
|
|
1022
1022
|
* @returns 최소값
|
|
@@ -1031,9 +1031,9 @@ export declare const expr: {
|
|
|
1031
1031
|
*/
|
|
1032
1032
|
least<T extends ColumnPrimitive>(...args: ExprInput<T>[]): ExprUnit<T>;
|
|
1033
1033
|
/**
|
|
1034
|
-
*
|
|
1034
|
+
* row 번호 (ROW_NUMBER 없이 전체 행에 대한 순번)
|
|
1035
1035
|
*
|
|
1036
|
-
* @returns
|
|
1036
|
+
* @returns row 번호 (1부터 start)
|
|
1037
1037
|
*
|
|
1038
1038
|
* @example
|
|
1039
1039
|
* ```typescript
|
|
@@ -1045,25 +1045,25 @@ export declare const expr: {
|
|
|
1045
1045
|
*/
|
|
1046
1046
|
rowNum(): ExprUnit<number>;
|
|
1047
1047
|
/**
|
|
1048
|
-
* 난수
|
|
1048
|
+
* 난수 Generate (RAND/RANDOM)
|
|
1049
1049
|
*
|
|
1050
|
-
* 0~1 사이의 난수
|
|
1050
|
+
* 0~1 사이의 난수 return. ORDER BY에서 랜덤 정렬용으로 주로 사용
|
|
1051
1051
|
*
|
|
1052
1052
|
* @returns 0~1 사이의 난수
|
|
1053
1053
|
*
|
|
1054
1054
|
* @example
|
|
1055
1055
|
* ```typescript
|
|
1056
|
-
* // 랜덤
|
|
1056
|
+
* // 랜덤 sorting
|
|
1057
1057
|
* db.user().orderBy(() => expr.random()).limit(10)
|
|
1058
1058
|
* ```
|
|
1059
1059
|
*/
|
|
1060
1060
|
random(): ExprUnit<number>;
|
|
1061
1061
|
/**
|
|
1062
|
-
*
|
|
1062
|
+
* type transformation (CAST)
|
|
1063
1063
|
*
|
|
1064
|
-
* @param source -
|
|
1065
|
-
* @param targetType - 대상
|
|
1066
|
-
* @returns
|
|
1064
|
+
* @param source - Transform할 expression
|
|
1065
|
+
* @param targetType - 대상 data type
|
|
1066
|
+
* @returns Transform된 expression
|
|
1067
1067
|
*
|
|
1068
1068
|
* @example
|
|
1069
1069
|
* ```typescript
|
|
@@ -1075,13 +1075,13 @@ export declare const expr: {
|
|
|
1075
1075
|
*/
|
|
1076
1076
|
cast<T extends ColumnPrimitive, TDataType extends DataType>(source: ExprUnit<T>, targetType: TDataType): ExprUnit<T extends undefined ? undefined : InferColumnPrimitiveFromDataType<TDataType>>;
|
|
1077
1077
|
/**
|
|
1078
|
-
* 스칼라
|
|
1078
|
+
* 스칼라 Subquery - SELECT 절에서 단일 value return Subquery
|
|
1079
1079
|
*
|
|
1080
|
-
*
|
|
1080
|
+
* Subquery는 반드시 단일 row, 단일 column을 반환해야 함
|
|
1081
1081
|
*
|
|
1082
|
-
* @param dataType -
|
|
1082
|
+
* @param dataType - Data type of the returned value
|
|
1083
1083
|
* @param queryable - 스칼라 값을 반환하는 Queryable
|
|
1084
|
-
* @returns
|
|
1084
|
+
* @returns Subquery result expression
|
|
1085
1085
|
*
|
|
1086
1086
|
* @example
|
|
1087
1087
|
* ```typescript
|
|
@@ -1101,12 +1101,12 @@ export declare const expr: {
|
|
|
1101
1101
|
getSelectQueryDef(): SelectQueryDef;
|
|
1102
1102
|
}): ExprUnit<ColumnPrimitiveMap[TStr] | undefined>;
|
|
1103
1103
|
/**
|
|
1104
|
-
* ROW_NUMBER() - 파티션 내
|
|
1104
|
+
* ROW_NUMBER() - 파티션 내 row 번호
|
|
1105
1105
|
*
|
|
1106
|
-
* 각 파티션 내에서 1부터 시작하는
|
|
1106
|
+
* 각 파티션 내에서 1부터 시작하는 sequential 번호 부여
|
|
1107
1107
|
*
|
|
1108
|
-
* @param spec -
|
|
1109
|
-
* @returns
|
|
1108
|
+
* @param spec - Window spec (partitionBy, orderBy)
|
|
1109
|
+
* @returns row 번호 (1부터 start)
|
|
1110
1110
|
*
|
|
1111
1111
|
* @example
|
|
1112
1112
|
* ```typescript
|
|
@@ -1124,7 +1124,7 @@ export declare const expr: {
|
|
|
1124
1124
|
/**
|
|
1125
1125
|
* RANK() - 파티션 내 순위 (동점 시 같은 순위, 다음 순위 건너뜀)
|
|
1126
1126
|
*
|
|
1127
|
-
* @param spec -
|
|
1127
|
+
* @param spec - Window spec (partitionBy, orderBy)
|
|
1128
1128
|
* @returns 순위 (동점 후 건너뜀: 1, 1, 3)
|
|
1129
1129
|
*
|
|
1130
1130
|
* @example
|
|
@@ -1141,7 +1141,7 @@ export declare const expr: {
|
|
|
1141
1141
|
/**
|
|
1142
1142
|
* DENSE_RANK() - 파티션 내 밀집 순위 (동점 시 같은 순위, 다음 순위 유지)
|
|
1143
1143
|
*
|
|
1144
|
-
* @param spec -
|
|
1144
|
+
* @param spec - Window spec (partitionBy, orderBy)
|
|
1145
1145
|
* @returns 밀집 순위 (동점 후 연속: 1, 1, 2)
|
|
1146
1146
|
*
|
|
1147
1147
|
* @example
|
|
@@ -1156,15 +1156,15 @@ export declare const expr: {
|
|
|
1156
1156
|
*/
|
|
1157
1157
|
denseRank(spec: WinSpecInput): ExprUnit<number>;
|
|
1158
1158
|
/**
|
|
1159
|
-
* NTILE(n) - 파티션을 n개 그룹으로
|
|
1159
|
+
* NTILE(n) - 파티션을 n개 그룹으로 split
|
|
1160
1160
|
*
|
|
1161
1161
|
* @param n - 분할할 그룹 수
|
|
1162
|
-
* @param spec -
|
|
1162
|
+
* @param spec - Window spec (partitionBy, orderBy)
|
|
1163
1163
|
* @returns 그룹 번호 (1 ~ n)
|
|
1164
1164
|
*
|
|
1165
1165
|
* @example
|
|
1166
1166
|
* ```typescript
|
|
1167
|
-
* // 상위 25%를 찾기 위한 사분위
|
|
1167
|
+
* // 상위 25%를 찾기 위한 사분위 split
|
|
1168
1168
|
* db.user().select((u) => ({
|
|
1169
1169
|
* name: u.name,
|
|
1170
1170
|
* quartile: expr.ntile(4, {
|
|
@@ -1175,12 +1175,12 @@ export declare const expr: {
|
|
|
1175
1175
|
*/
|
|
1176
1176
|
ntile(n: number, spec: WinSpecInput): ExprUnit<number>;
|
|
1177
1177
|
/**
|
|
1178
|
-
* LAG() - 이전 행의
|
|
1178
|
+
* LAG() - 이전 행의 value 참조
|
|
1179
1179
|
*
|
|
1180
|
-
* @param column -
|
|
1181
|
-
* @param spec -
|
|
1182
|
-
* @param options - offset (
|
|
1183
|
-
* @returns 이전 행의
|
|
1180
|
+
* @param column - column to reference
|
|
1181
|
+
* @param spec - Window spec (partitionBy, orderBy)
|
|
1182
|
+
* @param options - offset (Basic 1), default (이전 행이 없을 때 Default value)
|
|
1183
|
+
* @returns 이전 행의 value (또는 Default value/NULL)
|
|
1184
1184
|
*
|
|
1185
1185
|
* @example
|
|
1186
1186
|
* ```typescript
|
|
@@ -1199,12 +1199,12 @@ export declare const expr: {
|
|
|
1199
1199
|
default?: ExprInput<T>;
|
|
1200
1200
|
}): ExprUnit<T | undefined>;
|
|
1201
1201
|
/**
|
|
1202
|
-
* LEAD() - 다음 행의
|
|
1202
|
+
* LEAD() - 다음 행의 value 참조
|
|
1203
1203
|
*
|
|
1204
|
-
* @param column -
|
|
1205
|
-
* @param spec -
|
|
1206
|
-
* @param options - offset (
|
|
1207
|
-
* @returns 다음 행의
|
|
1204
|
+
* @param column - column to reference
|
|
1205
|
+
* @param spec - Window spec (partitionBy, orderBy)
|
|
1206
|
+
* @param options - offset (Basic 1), default (다음 행이 없을 때 Default value)
|
|
1207
|
+
* @returns 다음 행의 value (또는 Default value/NULL)
|
|
1208
1208
|
*
|
|
1209
1209
|
* @example
|
|
1210
1210
|
* ```typescript
|
|
@@ -1223,11 +1223,11 @@ export declare const expr: {
|
|
|
1223
1223
|
default?: ExprInput<T>;
|
|
1224
1224
|
}): ExprUnit<T | undefined>;
|
|
1225
1225
|
/**
|
|
1226
|
-
* FIRST_VALUE() - 파티션/프레임의 첫 번째
|
|
1226
|
+
* FIRST_VALUE() - 파티션/프레임의 첫 번째 value
|
|
1227
1227
|
*
|
|
1228
|
-
* @param column -
|
|
1229
|
-
* @param spec -
|
|
1230
|
-
* @returns 첫 번째
|
|
1228
|
+
* @param column - column to reference
|
|
1229
|
+
* @param spec - Window spec (partitionBy, orderBy)
|
|
1230
|
+
* @returns 첫 번째 value
|
|
1231
1231
|
*
|
|
1232
1232
|
* @example
|
|
1233
1233
|
* ```typescript
|
|
@@ -1242,11 +1242,11 @@ export declare const expr: {
|
|
|
1242
1242
|
*/
|
|
1243
1243
|
firstValue<T extends ColumnPrimitive>(column: ExprUnit<T>, spec: WinSpecInput): ExprUnit<T | undefined>;
|
|
1244
1244
|
/**
|
|
1245
|
-
* LAST_VALUE() - 파티션/프레임의 마지막
|
|
1245
|
+
* LAST_VALUE() - 파티션/프레임의 마지막 value
|
|
1246
1246
|
*
|
|
1247
|
-
* @param column -
|
|
1248
|
-
* @param spec -
|
|
1249
|
-
* @returns 마지막
|
|
1247
|
+
* @param column - column to reference
|
|
1248
|
+
* @param spec - Window spec (partitionBy, orderBy)
|
|
1249
|
+
* @returns 마지막 value
|
|
1250
1250
|
*
|
|
1251
1251
|
* @example
|
|
1252
1252
|
* ```typescript
|
|
@@ -1261,11 +1261,11 @@ export declare const expr: {
|
|
|
1261
1261
|
*/
|
|
1262
1262
|
lastValue<T extends ColumnPrimitive>(column: ExprUnit<T>, spec: WinSpecInput): ExprUnit<T | undefined>;
|
|
1263
1263
|
/**
|
|
1264
|
-
* SUM() OVER -
|
|
1264
|
+
* SUM() OVER - Window 합계
|
|
1265
1265
|
*
|
|
1266
|
-
* @param column - 합계를 구할
|
|
1267
|
-
* @param spec -
|
|
1268
|
-
* @returns
|
|
1266
|
+
* @param column - 합계를 구할 column
|
|
1267
|
+
* @param spec - Window spec (partitionBy, orderBy)
|
|
1268
|
+
* @returns Window 내 합계
|
|
1269
1269
|
*
|
|
1270
1270
|
* @example
|
|
1271
1271
|
* ```typescript
|
|
@@ -1281,15 +1281,15 @@ export declare const expr: {
|
|
|
1281
1281
|
*/
|
|
1282
1282
|
sumOver(column: ExprUnit<number | undefined>, spec: WinSpecInput): ExprUnit<number | undefined>;
|
|
1283
1283
|
/**
|
|
1284
|
-
* AVG() OVER -
|
|
1284
|
+
* AVG() OVER - Window 평균
|
|
1285
1285
|
*
|
|
1286
|
-
* @param column - 평균을 구할
|
|
1287
|
-
* @param spec -
|
|
1288
|
-
* @returns
|
|
1286
|
+
* @param column - 평균을 구할 column
|
|
1287
|
+
* @param spec - Window spec (partitionBy, orderBy)
|
|
1288
|
+
* @returns Window 내 평균
|
|
1289
1289
|
*
|
|
1290
1290
|
* @example
|
|
1291
1291
|
* ```typescript
|
|
1292
|
-
* //
|
|
1292
|
+
* // move 평균
|
|
1293
1293
|
* db.stock().select((s) => ({
|
|
1294
1294
|
* ...s,
|
|
1295
1295
|
* movingAvg: expr.avgOver(s.price, {
|
|
@@ -1301,11 +1301,11 @@ export declare const expr: {
|
|
|
1301
1301
|
*/
|
|
1302
1302
|
avgOver(column: ExprUnit<number | undefined>, spec: WinSpecInput): ExprUnit<number | undefined>;
|
|
1303
1303
|
/**
|
|
1304
|
-
* COUNT() OVER -
|
|
1304
|
+
* COUNT() OVER - Window 카운트
|
|
1305
1305
|
*
|
|
1306
|
-
* @param spec -
|
|
1307
|
-
* @param column - 카운트할
|
|
1308
|
-
* @returns
|
|
1306
|
+
* @param spec - Window spec (partitionBy, orderBy)
|
|
1307
|
+
* @param column - 카운트할 column (생략 시 전체 row 수)
|
|
1308
|
+
* @returns Window 내 row 수
|
|
1309
1309
|
*
|
|
1310
1310
|
* @example
|
|
1311
1311
|
* ```typescript
|
|
@@ -1319,11 +1319,11 @@ export declare const expr: {
|
|
|
1319
1319
|
*/
|
|
1320
1320
|
countOver(spec: WinSpecInput, column?: ExprUnit<ColumnPrimitive>): ExprUnit<number>;
|
|
1321
1321
|
/**
|
|
1322
|
-
* MIN() OVER -
|
|
1322
|
+
* MIN() OVER - Window 최소값
|
|
1323
1323
|
*
|
|
1324
|
-
* @param column - 최소값을 구할
|
|
1325
|
-
* @param spec -
|
|
1326
|
-
* @returns
|
|
1324
|
+
* @param column - 최소값을 구할 column
|
|
1325
|
+
* @param spec - Window spec (partitionBy, orderBy)
|
|
1326
|
+
* @returns Window 내 최소값
|
|
1327
1327
|
*
|
|
1328
1328
|
* @example
|
|
1329
1329
|
* ```typescript
|
|
@@ -1337,11 +1337,11 @@ export declare const expr: {
|
|
|
1337
1337
|
*/
|
|
1338
1338
|
minOver<T extends ColumnPrimitive>(column: ExprUnit<T>, spec: WinSpecInput): ExprUnit<T | undefined>;
|
|
1339
1339
|
/**
|
|
1340
|
-
* MAX() OVER -
|
|
1340
|
+
* MAX() OVER - Window 최대값
|
|
1341
1341
|
*
|
|
1342
|
-
* @param column - 최대값을 구할
|
|
1343
|
-
* @param spec -
|
|
1344
|
-
* @returns
|
|
1342
|
+
* @param column - 최대값을 구할 column
|
|
1343
|
+
* @param spec - Window spec (partitionBy, orderBy)
|
|
1344
|
+
* @returns Window 내 최대값
|
|
1345
1345
|
*
|
|
1346
1346
|
* @example
|
|
1347
1347
|
* ```typescript
|
|
@@ -1355,9 +1355,9 @@ export declare const expr: {
|
|
|
1355
1355
|
*/
|
|
1356
1356
|
maxOver<T extends ColumnPrimitive>(column: ExprUnit<T>, spec: WinSpecInput): ExprUnit<T | undefined>;
|
|
1357
1357
|
/**
|
|
1358
|
-
* ExprInput을 Expr로
|
|
1358
|
+
* ExprInput을 Expr로 Transform (내부용)
|
|
1359
1359
|
*
|
|
1360
|
-
* @param value -
|
|
1360
|
+
* @param value - Transform할 value
|
|
1361
1361
|
* @returns Expr JSON AST
|
|
1362
1362
|
*/
|
|
1363
1363
|
toExpr(value: ExprInput<ColumnPrimitive>): Expr;
|