@simplysm/orm-common 14.0.50 → 14.0.52
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/exec/queryable.d.ts +1 -1
- package/dist/exec/queryable.d.ts.map +1 -1
- package/dist/exec/queryable.js +8 -2
- package/dist/exec/queryable.js.map +1 -1
- package/package.json +3 -4
- package/src/exec/queryable.ts +10 -3
- package/README.md +0 -136
- package/docs/core/db-context.md +0 -208
- package/docs/core/db-transaction-error.md +0 -64
- package/docs/expression/expr-unit.md +0 -62
- package/docs/expression/expr.md +0 -198
- package/docs/models/migration.md +0 -37
- package/docs/query-builder/create-query-builder.md +0 -80
- package/docs/queryable-executable/executable.md +0 -54
- package/docs/queryable-executable/parse-search-query.md +0 -75
- package/docs/queryable-executable/queryable.md +0 -238
- package/docs/schema-builders/column-builder.md +0 -63
- package/docs/schema-builders/foreign-key-builder.md +0 -137
- package/docs/schema-builders/index-builder.md +0 -54
- package/docs/schema-builders/procedure.md +0 -67
- package/docs/schema-builders/table.md +0 -94
- package/docs/schema-builders/view.md +0 -71
- package/docs/types/data-type.md +0 -146
- package/docs/types/dialect.md +0 -151
- package/docs/types/expr.md +0 -175
- package/docs/types/parse-query-result.md +0 -58
- package/docs/types/query-def.md +0 -224
package/docs/types/query-def.md
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
# QueryDef
|
|
2
|
-
|
|
3
|
-
SQL AST 정의 타입 모음. `Queryable`이 내부적으로 생성하며, `QueryBuilderBase.build(def)`에 전달되어 SQL 문자열로 변환된다.
|
|
4
|
-
|
|
5
|
-
## `QueryDef`
|
|
6
|
-
|
|
7
|
-
모든 쿼리 정의의 유니온 타입.
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
export type QueryDef =
|
|
11
|
-
| SelectQueryDef
|
|
12
|
-
| InsertQueryDef
|
|
13
|
-
| InsertIfNotExistsQueryDef
|
|
14
|
-
| InsertIntoQueryDef
|
|
15
|
-
| UpdateQueryDef
|
|
16
|
-
| DeleteQueryDef
|
|
17
|
-
| UpsertQueryDef
|
|
18
|
-
| SwitchFkQueryDef
|
|
19
|
-
| CreateTableQueryDef
|
|
20
|
-
| DropTableQueryDef
|
|
21
|
-
| RenameTableQueryDef
|
|
22
|
-
| TruncateQueryDef
|
|
23
|
-
| AddColumnQueryDef
|
|
24
|
-
| DropColumnQueryDef
|
|
25
|
-
| ModifyColumnQueryDef
|
|
26
|
-
| RenameColumnQueryDef
|
|
27
|
-
| AddPrimaryKeyQueryDef
|
|
28
|
-
| DropPrimaryKeyQueryDef
|
|
29
|
-
| AddForeignKeyQueryDef
|
|
30
|
-
| DropForeignKeyQueryDef
|
|
31
|
-
| AddIndexQueryDef
|
|
32
|
-
| DropIndexQueryDef
|
|
33
|
-
| CreateViewQueryDef
|
|
34
|
-
| DropViewQueryDef
|
|
35
|
-
| CreateProcQueryDef
|
|
36
|
-
| DropProcQueryDef
|
|
37
|
-
| ExecProcQueryDef
|
|
38
|
-
| ClearSchemaQueryDef
|
|
39
|
-
| SchemaExistsQueryDef;
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## `QueryDefObjectName`
|
|
43
|
-
|
|
44
|
-
DB 객체 이름 (테이블, 뷰, 프로시저 등).
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
export interface QueryDefObjectName {
|
|
48
|
-
database?: string;
|
|
49
|
-
schema?: string;
|
|
50
|
-
name: string;
|
|
51
|
-
}
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
DBMS별 네임스페이스 처리:
|
|
55
|
-
- MySQL: `database.name` (schema 무시)
|
|
56
|
-
- MSSQL: `database.schema.name` (schema 기본값 dbo)
|
|
57
|
-
- PostgreSQL: `schema.name` (database는 연결용)
|
|
58
|
-
|
|
59
|
-
## DML 쿼리 정의
|
|
60
|
-
|
|
61
|
-
### `SelectQueryDef`
|
|
62
|
-
|
|
63
|
-
```typescript
|
|
64
|
-
export interface SelectQueryDef {
|
|
65
|
-
type: "select";
|
|
66
|
-
from?: QueryDefObjectName | SelectQueryDef | SelectQueryDef[] | string;
|
|
67
|
-
as: string;
|
|
68
|
-
select?: Record<string, Expr>;
|
|
69
|
-
distinct?: boolean;
|
|
70
|
-
top?: number;
|
|
71
|
-
lock?: boolean;
|
|
72
|
-
where?: WhereExpr[];
|
|
73
|
-
joins?: SelectQueryDefJoin[];
|
|
74
|
-
orderBy?: [Expr, ("ASC" | "DESC")?][];
|
|
75
|
-
limit?: [number, number];
|
|
76
|
-
groupBy?: Expr[];
|
|
77
|
-
having?: WhereExpr[];
|
|
78
|
-
with?: { name: string; base: SelectQueryDef; recursive: SelectQueryDef };
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### `SelectQueryDefJoin`
|
|
83
|
-
|
|
84
|
-
```typescript
|
|
85
|
-
export interface SelectQueryDefJoin extends SelectQueryDef {
|
|
86
|
-
isSingle?: boolean;
|
|
87
|
-
}
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### `InsertQueryDef`
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
export interface InsertQueryDef {
|
|
94
|
-
type: "insert";
|
|
95
|
-
table: QueryDefObjectName;
|
|
96
|
-
records: Record<string, ColumnPrimitive>[];
|
|
97
|
-
overrideIdentity?: boolean;
|
|
98
|
-
output?: CudOutputDef;
|
|
99
|
-
}
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### `InsertIfNotExistsQueryDef`
|
|
103
|
-
|
|
104
|
-
```typescript
|
|
105
|
-
export interface InsertIfNotExistsQueryDef {
|
|
106
|
-
type: "insertIfNotExists";
|
|
107
|
-
table: QueryDefObjectName;
|
|
108
|
-
record: Record<string, ColumnPrimitive>;
|
|
109
|
-
existsSelectQuery: SelectQueryDef;
|
|
110
|
-
overrideIdentity?: boolean;
|
|
111
|
-
output?: CudOutputDef;
|
|
112
|
-
}
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### `InsertIntoQueryDef`
|
|
116
|
-
|
|
117
|
-
```typescript
|
|
118
|
-
export interface InsertIntoQueryDef {
|
|
119
|
-
type: "insertInto";
|
|
120
|
-
table: QueryDefObjectName;
|
|
121
|
-
recordsSelectQuery: SelectQueryDef;
|
|
122
|
-
overrideIdentity?: boolean;
|
|
123
|
-
output?: CudOutputDef;
|
|
124
|
-
}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
### `UpdateQueryDef`
|
|
128
|
-
|
|
129
|
-
```typescript
|
|
130
|
-
export interface UpdateQueryDef {
|
|
131
|
-
type: "update";
|
|
132
|
-
table: QueryDefObjectName;
|
|
133
|
-
as: string;
|
|
134
|
-
record: Record<string, Expr>;
|
|
135
|
-
top?: number;
|
|
136
|
-
where?: WhereExpr[];
|
|
137
|
-
joins?: SelectQueryDefJoin[];
|
|
138
|
-
limit?: [number, number];
|
|
139
|
-
output?: CudOutputDef;
|
|
140
|
-
}
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### `DeleteQueryDef`
|
|
144
|
-
|
|
145
|
-
```typescript
|
|
146
|
-
export interface DeleteQueryDef {
|
|
147
|
-
type: "delete";
|
|
148
|
-
table: QueryDefObjectName;
|
|
149
|
-
as: string;
|
|
150
|
-
top?: number;
|
|
151
|
-
where?: WhereExpr[];
|
|
152
|
-
joins?: SelectQueryDefJoin[];
|
|
153
|
-
limit?: [number, number];
|
|
154
|
-
output?: CudOutputDef;
|
|
155
|
-
}
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
### `UpsertQueryDef`
|
|
159
|
-
|
|
160
|
-
```typescript
|
|
161
|
-
export interface UpsertQueryDef {
|
|
162
|
-
type: "upsert";
|
|
163
|
-
table: QueryDefObjectName;
|
|
164
|
-
existsSelectQuery: SelectQueryDef;
|
|
165
|
-
insertRecord: Record<string, Expr>;
|
|
166
|
-
updateRecord: Record<string, Expr>;
|
|
167
|
-
overrideIdentity?: boolean;
|
|
168
|
-
output?: CudOutputDef;
|
|
169
|
-
}
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
## `CudOutputDef`
|
|
173
|
-
|
|
174
|
-
INSERT/UPDATE/DELETE 후 반환값 정의 (OUTPUT 절).
|
|
175
|
-
|
|
176
|
-
```typescript
|
|
177
|
-
export interface CudOutputDef {
|
|
178
|
-
columns: string[];
|
|
179
|
-
pkColNames: string[];
|
|
180
|
-
aiColName?: string;
|
|
181
|
-
}
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
| 필드 | 타입 | 설명 |
|
|
185
|
-
|------|------|------|
|
|
186
|
-
| `columns` | `string[]` | 반환할 컬럼 이름 배열 |
|
|
187
|
-
| `pkColNames` | `string[]` | PK 컬럼 이름 배열 |
|
|
188
|
-
| `aiColName` | `string \| undefined` | AUTO_INCREMENT 컬럼 이름 |
|
|
189
|
-
|
|
190
|
-
## DDL 쿼리 정의
|
|
191
|
-
|
|
192
|
-
| 인터페이스 | `type` 값 | 설명 |
|
|
193
|
-
|------------|-----------|------|
|
|
194
|
-
| `CreateTableQueryDef` | `"createTable"` | CREATE TABLE |
|
|
195
|
-
| `DropTableQueryDef` | `"dropTable"` | DROP TABLE |
|
|
196
|
-
| `RenameTableQueryDef` | `"renameTable"` | RENAME TABLE |
|
|
197
|
-
| `TruncateQueryDef` | `"truncate"` | TRUNCATE TABLE |
|
|
198
|
-
| `AddColumnQueryDef` | `"addColumn"` | ADD COLUMN |
|
|
199
|
-
| `DropColumnQueryDef` | `"dropColumn"` | DROP COLUMN |
|
|
200
|
-
| `ModifyColumnQueryDef` | `"modifyColumn"` | MODIFY/ALTER COLUMN |
|
|
201
|
-
| `RenameColumnQueryDef` | `"renameColumn"` | RENAME COLUMN |
|
|
202
|
-
| `AddPrimaryKeyQueryDef` | `"addPrimaryKey"` | ADD PRIMARY KEY |
|
|
203
|
-
| `DropPrimaryKeyQueryDef` | `"dropPrimaryKey"` | DROP PRIMARY KEY |
|
|
204
|
-
| `AddForeignKeyQueryDef` | `"addForeignKey"` | ADD FOREIGN KEY |
|
|
205
|
-
| `DropForeignKeyQueryDef` | `"dropForeignKey"` | DROP FOREIGN KEY |
|
|
206
|
-
| `AddIndexQueryDef` | `"addIndex"` | ADD INDEX |
|
|
207
|
-
| `DropIndexQueryDef` | `"dropIndex"` | DROP INDEX |
|
|
208
|
-
| `CreateViewQueryDef` | `"createView"` | CREATE VIEW |
|
|
209
|
-
| `DropViewQueryDef` | `"dropView"` | DROP VIEW |
|
|
210
|
-
| `CreateProcQueryDef` | `"createProc"` | CREATE PROCEDURE |
|
|
211
|
-
| `DropProcQueryDef` | `"dropProc"` | DROP PROCEDURE |
|
|
212
|
-
| `ExecProcQueryDef` | `"execProc"` | EXEC PROCEDURE |
|
|
213
|
-
| `ClearSchemaQueryDef` | `"clearSchema"` | 스키마 내 모든 객체 제거 |
|
|
214
|
-
| `SchemaExistsQueryDef` | `"schemaExists"` | 스키마 존재 여부 확인 |
|
|
215
|
-
| `SwitchFkQueryDef` | `"switchFk"` | FK 제약조건 활성화/비활성화 |
|
|
216
|
-
|
|
217
|
-
## `DDL_TYPES` / `DdlType`
|
|
218
|
-
|
|
219
|
-
DDL 타입 문자열 목록 및 유니온 타입. `DbContext.executeDefs()` 내부에서 트랜잭션 중 DDL 실행 차단에 사용된다.
|
|
220
|
-
|
|
221
|
-
```typescript
|
|
222
|
-
export const DDL_TYPES: readonly string[];
|
|
223
|
-
export type DdlType = typeof DDL_TYPES[number];
|
|
224
|
-
```
|