@eggjs/dal-decorator 4.0.0-beta.8 → 4.0.1-beta.0

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.
Files changed (39) hide show
  1. package/README.md +1 -1
  2. package/dist/decorator/Column.d.ts +6 -0
  3. package/dist/decorator/Column.js +17 -0
  4. package/dist/decorator/Dao.d.ts +6 -0
  5. package/dist/decorator/Dao.js +20 -0
  6. package/dist/decorator/DataSourceQualifier.d.ts +4 -0
  7. package/dist/decorator/DataSourceQualifier.js +12 -0
  8. package/dist/decorator/Table.d.ts +6 -0
  9. package/dist/decorator/Table.js +21 -0
  10. package/dist/decorator/TableIndex.d.ts +6 -0
  11. package/dist/decorator/TableIndex.js +12 -0
  12. package/dist/decorator/index.d.ts +5 -0
  13. package/dist/decorator/index.js +7 -0
  14. package/dist/index.d.ts +19 -175
  15. package/dist/index.js +17 -358
  16. package/dist/model/ColumnModel.d.ts +38 -0
  17. package/dist/model/ColumnModel.js +59 -0
  18. package/dist/model/IndexModel.d.ts +32 -0
  19. package/dist/model/IndexModel.js +51 -0
  20. package/dist/model/TableModel.d.ts +55 -0
  21. package/dist/model/TableModel.js +116 -0
  22. package/dist/model/index.d.ts +3 -0
  23. package/dist/model/index.js +5 -0
  24. package/dist/type/MySql.d.ts +2 -0
  25. package/dist/type/Spatial.d.ts +14 -0
  26. package/dist/type/Spatial.js +31 -0
  27. package/dist/type/index.d.ts +2 -0
  28. package/dist/type/index.js +3 -0
  29. package/dist/util/ColumnInfoUtil.d.ts +13 -0
  30. package/dist/util/ColumnInfoUtil.js +21 -0
  31. package/dist/util/DaoInfoUtil.d.ts +9 -0
  32. package/dist/util/DaoInfoUtil.js +15 -0
  33. package/dist/util/IndexInfoUtil.d.ts +9 -0
  34. package/dist/util/IndexInfoUtil.js +15 -0
  35. package/dist/util/TableInfoUtil.d.ts +13 -0
  36. package/dist/util/TableInfoUtil.js +26 -0
  37. package/dist/util/index.d.ts +4 -0
  38. package/dist/util/index.js +6 -0
  39. package/package.json +32 -35
package/dist/index.js CHANGED
@@ -1,362 +1,21 @@
1
- import assert from "node:assert";
2
- import { AccessLevel, ColumnType, DAL_COLUMN_INFO_MAP, DAL_COLUMN_TYPE_MAP, DAL_INDEX_LIST, DAL_IS_DAO, DAL_IS_TABLE, DAL_TABLE_PARAMS, DataSourceQualifierAttribute, IndexType, ObjectInitType } from "@eggjs/tegg-types";
3
- import { MetadataUtil, Prototype, PrototypeUtil, QualifierUtil } from "@eggjs/core-decorator";
4
- import { StackUtil } from "@eggjs/tegg-common-util";
5
- import snakecase from "lodash.snakecase";
6
- import pluralize from "pluralize";
1
+ import { ColumnInfoUtil } from "./util/ColumnInfoUtil.js";
2
+ import { DaoInfoUtil } from "./util/DaoInfoUtil.js";
3
+ import { IndexInfoUtil } from "./util/IndexInfoUtil.js";
4
+ import { TABLE_CLAZZ_LIST, TableInfoUtil } from "./util/TableInfoUtil.js";
5
+ import "./util/index.js";
6
+ import { Column } from "./decorator/Column.js";
7
+ import { Dao } from "./decorator/Dao.js";
8
+ import { DataSourceQualifier } from "./decorator/DataSourceQualifier.js";
9
+ import { Table } from "./decorator/Table.js";
10
+ import { Index } from "./decorator/TableIndex.js";
11
+ import "./decorator/index.js";
12
+ import { ColumnModel } from "./model/ColumnModel.js";
13
+ import { IndexModel } from "./model/IndexModel.js";
14
+ import { TableModel } from "./model/TableModel.js";
15
+ import "./model/index.js";
16
+ import { SpatialHelper } from "./type/Spatial.js";
17
+ import "./type/index.js";
7
18
 
8
19
  export * from "@eggjs/tegg-types/dal"
9
20
 
10
- //#region src/util/ColumnInfoUtil.ts
11
- var ColumnInfoUtil = class {
12
- static addColumnInfo(clazz, property, column) {
13
- MetadataUtil.initOwnMapMetaData(DAL_COLUMN_INFO_MAP, clazz, /* @__PURE__ */ new Map()).set(property, column);
14
- }
15
- static addColumnType(clazz, property, type) {
16
- MetadataUtil.initOwnMapMetaData(DAL_COLUMN_TYPE_MAP, clazz, /* @__PURE__ */ new Map()).set(property, type);
17
- }
18
- static getColumnInfoMap(clazz) {
19
- return MetadataUtil.getMetaData(DAL_COLUMN_INFO_MAP, clazz);
20
- }
21
- static getColumnTypeMap(clazz) {
22
- return MetadataUtil.getMetaData(DAL_COLUMN_TYPE_MAP, clazz);
23
- }
24
- };
25
-
26
- //#endregion
27
- //#region src/util/DaoInfoUtil.ts
28
- var DaoInfoUtil = class {
29
- static setIsDao(clazz) {
30
- MetadataUtil.defineMetaData(DAL_IS_DAO, true, clazz);
31
- }
32
- static getIsDao(clazz) {
33
- return MetadataUtil.getOwnMetaData(DAL_IS_DAO, clazz) === true;
34
- }
35
- };
36
-
37
- //#endregion
38
- //#region src/util/IndexInfoUtil.ts
39
- var IndexInfoUtil = class {
40
- static addIndex(clazz, index) {
41
- MetadataUtil.initOwnArrayMetaData(DAL_INDEX_LIST, clazz, []).push(index);
42
- }
43
- static getIndexList(clazz) {
44
- return MetadataUtil.getMetaData(DAL_INDEX_LIST, clazz) || [];
45
- }
46
- };
47
-
48
- //#endregion
49
- //#region src/util/TableInfoUtil.ts
50
- const TABLE_CLAZZ_LIST = [];
51
- var TableInfoUtil = class {
52
- static setIsTable(clazz) {
53
- TABLE_CLAZZ_LIST.push(clazz);
54
- MetadataUtil.defineMetaData(DAL_IS_TABLE, true, clazz);
55
- }
56
- static getClazzList() {
57
- return TABLE_CLAZZ_LIST;
58
- }
59
- static getIsTable(clazz) {
60
- return MetadataUtil.getMetaData(DAL_IS_TABLE, clazz) === true;
61
- }
62
- static setTableParams(clazz, params) {
63
- MetadataUtil.defineMetaData(DAL_TABLE_PARAMS, params, clazz);
64
- }
65
- static getTableParams(clazz) {
66
- return MetadataUtil.getMetaData(DAL_TABLE_PARAMS, clazz);
67
- }
68
- };
69
-
70
- //#endregion
71
- //#region src/decorator/Column.ts
72
- function Column(type, params) {
73
- return function(target, propertyKey) {
74
- assert(typeof propertyKey === "string", `[Column/${target.name}] expect column name be typeof string, but now is ${String(propertyKey)}`);
75
- const tableClazz = target.constructor;
76
- const columnName = propertyKey;
77
- ColumnInfoUtil.addColumnType(tableClazz, columnName, type);
78
- if (params) ColumnInfoUtil.addColumnInfo(tableClazz, columnName, params);
79
- };
80
- }
81
-
82
- //#endregion
83
- //#region src/decorator/Dao.ts
84
- function Dao() {
85
- return function(constructor) {
86
- DaoInfoUtil.setIsDao(constructor);
87
- Prototype({
88
- accessLevel: AccessLevel.PUBLIC,
89
- initType: ObjectInitType.SINGLETON
90
- })(constructor);
91
- PrototypeUtil.setFilePath(constructor, StackUtil.getCalleeFromStack(false, 5));
92
- };
93
- }
94
-
95
- //#endregion
96
- //#region src/decorator/DataSourceQualifier.ts
97
- function DataSourceQualifier(dataSourceName) {
98
- return function(target, propertyKey, parameterIndex) {
99
- QualifierUtil.addInjectQualifier(target, propertyKey, parameterIndex, DataSourceQualifierAttribute, dataSourceName);
100
- };
101
- }
102
-
103
- //#endregion
104
- //#region src/decorator/Table.ts
105
- function Table(params) {
106
- return function(constructor) {
107
- TableInfoUtil.setIsTable(constructor);
108
- if (params) TableInfoUtil.setTableParams(constructor, params);
109
- Prototype({
110
- accessLevel: AccessLevel.PUBLIC,
111
- initType: ObjectInitType.ALWAYS_NEW
112
- })(constructor);
113
- PrototypeUtil.setFilePath(constructor, StackUtil.getCalleeFromStack(false, 5));
114
- };
115
- }
116
-
117
- //#endregion
118
- //#region src/decorator/TableIndex.ts
119
- function Index(params) {
120
- return function(constructor) {
121
- IndexInfoUtil.addIndex(constructor, params);
122
- };
123
- }
124
-
125
- //#endregion
126
- //#region src/model/ColumnModel.ts
127
- var ColumnModel = class ColumnModel {
128
- columnName;
129
- propertyName;
130
- type;
131
- canNull;
132
- default;
133
- comment;
134
- visible;
135
- autoIncrement;
136
- uniqueKey;
137
- primaryKey;
138
- collate;
139
- columnFormat;
140
- engineAttribute;
141
- secondaryEngineAttribute;
142
- constructor(params) {
143
- this.columnName = params.columnName;
144
- this.propertyName = params.propertyName;
145
- this.type = params.type;
146
- this.canNull = params.canNull;
147
- this.default = params.default;
148
- this.comment = params.comment;
149
- this.visible = params.visible;
150
- this.autoIncrement = params.autoIncrement;
151
- this.uniqueKey = params.uniqueKey;
152
- this.primaryKey = params.primaryKey;
153
- this.collate = params.collate;
154
- this.columnFormat = params.columnFormat;
155
- this.engineAttribute = params.engineAttribute;
156
- this.secondaryEngineAttribute = params.secondaryEngineAttribute;
157
- }
158
- static build(property, type, params) {
159
- const columnName = params?.name ?? snakecase(property);
160
- let canNull = params?.canNull ?? false;
161
- if (params?.primaryKey) canNull = false;
162
- return new ColumnModel({
163
- columnName,
164
- propertyName: property,
165
- type,
166
- canNull,
167
- default: params?.default,
168
- comment: params?.comment,
169
- visible: params?.visible,
170
- autoIncrement: params?.autoIncrement,
171
- uniqueKey: params?.uniqueKey,
172
- primaryKey: params?.primaryKey,
173
- collate: params?.collate,
174
- columnFormat: params?.columnFormat,
175
- engineAttribute: params?.engineAttribute,
176
- secondaryEngineAttribute: params?.secondaryEngineAttribute
177
- });
178
- }
179
- };
180
-
181
- //#endregion
182
- //#region src/model/IndexModel.ts
183
- var IndexModel = class IndexModel {
184
- name;
185
- keys;
186
- type;
187
- storeType;
188
- comment;
189
- engineAttribute;
190
- secondaryEngineAttribute;
191
- parser;
192
- constructor(params) {
193
- this.name = params.name;
194
- this.keys = params.keys;
195
- this.type = params.type;
196
- this.storeType = params.storeType;
197
- this.comment = params.comment;
198
- this.engineAttribute = params.engineAttribute;
199
- this.secondaryEngineAttribute = params.secondaryEngineAttribute;
200
- this.parser = params.parser;
201
- }
202
- static buildIndexName(keys, type) {
203
- return (type === IndexType.UNIQUE ? "uk_" : "idx_") + keys.join("_");
204
- }
205
- static build(params, columns, clazz) {
206
- const type = params.type ?? IndexType.INDEX;
207
- const keys = params.keys.map((t) => {
208
- const column = columns.find((c) => c.propertyName === t);
209
- if (!column) throw new Error(`Table ${clazz.name} index configuration error: has no property named "${t}"`);
210
- return {
211
- propertyName: column.propertyName,
212
- columnName: column.columnName
213
- };
214
- });
215
- const name = params.name ?? IndexModel.buildIndexName(keys.map((t) => t.columnName), type);
216
- return new IndexModel({
217
- name,
218
- keys,
219
- type,
220
- storeType: params.storeType,
221
- comment: params.comment,
222
- engineAttribute: params.engineAttribute,
223
- secondaryEngineAttribute: params.secondaryEngineAttribute,
224
- parser: params.parser
225
- });
226
- }
227
- };
228
-
229
- //#endregion
230
- //#region src/model/TableModel.ts
231
- var TableModel = class TableModel {
232
- clazz;
233
- name;
234
- columns;
235
- indices;
236
- dataSourceName;
237
- comment;
238
- autoExtendSize;
239
- autoIncrement;
240
- avgRowLength;
241
- characterSet;
242
- collate;
243
- compression;
244
- encryption;
245
- engine;
246
- engineAttribute;
247
- insertMethod;
248
- keyBlockSize;
249
- maxRows;
250
- minRows;
251
- rowFormat;
252
- secondaryEngineAttribute;
253
- constructor(params) {
254
- this.clazz = params.clazz;
255
- this.name = params.name;
256
- this.dataSourceName = params.dataSourceName;
257
- this.columns = params.columns;
258
- this.indices = params.indices;
259
- this.comment = params.comment;
260
- this.autoExtendSize = params.autoExtendSize;
261
- this.autoIncrement = params.autoIncrement;
262
- this.avgRowLength = params.avgRowLength;
263
- this.characterSet = params.characterSet;
264
- this.collate = params.collate;
265
- this.compression = params.compression;
266
- this.encryption = params.encryption;
267
- this.engine = params.engine;
268
- this.engineAttribute = params.engineAttribute;
269
- this.insertMethod = params.insertMethod;
270
- this.keyBlockSize = params.keyBlockSize;
271
- this.maxRows = params.maxRows;
272
- this.minRows = params.minRows;
273
- this.rowFormat = params.rowFormat;
274
- this.secondaryEngineAttribute = params.secondaryEngineAttribute;
275
- }
276
- getPrimary() {
277
- const index = this.indices.find((t) => t.type === IndexType.PRIMARY);
278
- if (index) return index;
279
- const primaryColumn = this.columns.filter((t) => t.primaryKey === true);
280
- return new IndexModel({
281
- name: "PRIMARY",
282
- type: IndexType.PRIMARY,
283
- keys: primaryColumn.map((t) => {
284
- return {
285
- columnName: t.columnName,
286
- propertyName: t.propertyName
287
- };
288
- })
289
- });
290
- }
291
- static build(clazz) {
292
- const params = TableInfoUtil.getTableParams(clazz);
293
- const name = params?.name ?? snakecase(pluralize(clazz.name));
294
- const columnInfoMap = ColumnInfoUtil.getColumnInfoMap(clazz);
295
- const columnTypeMap = ColumnInfoUtil.getColumnTypeMap(clazz);
296
- const dataSourceName = params?.dataSourceName ?? "default";
297
- assert(TableInfoUtil.getIsTable(clazz), `${name} is not Table`);
298
- assert(columnTypeMap, `${name} has no columns`);
299
- const columns = [];
300
- const indices = [];
301
- for (const [property, columnType] of columnTypeMap?.entries() ?? []) {
302
- const columnParam = columnInfoMap?.get(property);
303
- columns.push(ColumnModel.build(property, columnType, columnParam));
304
- }
305
- const indexList = IndexInfoUtil.getIndexList(clazz);
306
- for (const index of indexList) indices.push(IndexModel.build(index, columns, clazz));
307
- return new TableModel({
308
- clazz,
309
- name,
310
- columns,
311
- indices,
312
- dataSourceName,
313
- comment: params?.comment,
314
- autoExtendSize: params?.autoExtendSize,
315
- autoIncrement: params?.autoIncrement,
316
- avgRowLength: params?.avgRowLength,
317
- characterSet: params?.characterSet,
318
- collate: params?.collate,
319
- compression: params?.compression,
320
- encryption: params?.encryption,
321
- engine: params?.engine,
322
- engineAttribute: params?.engineAttribute,
323
- insertMethod: params?.insertMethod,
324
- keyBlockSize: params?.keyBlockSize,
325
- maxRows: params?.maxRows,
326
- minRows: params?.minRows,
327
- rowFormat: params?.rowFormat,
328
- secondaryEngineAttribute: params?.secondaryEngineAttribute
329
- });
330
- }
331
- };
332
-
333
- //#endregion
334
- //#region src/type/Spatial.ts
335
- var SpatialHelper = class SpatialHelper {
336
- static isPoint(t) {
337
- return typeof Reflect.get(t, "x") === "number" && typeof Reflect.get(t, "y") === "number";
338
- }
339
- static isLine(t) {
340
- return Array.isArray(t) && t[0] && SpatialHelper.isPoint(t[0]);
341
- }
342
- static isPolygon(t) {
343
- return Array.isArray(t) && t[0] && SpatialHelper.isLine(t[0]);
344
- }
345
- static getGeometryType(t) {
346
- if (SpatialHelper.isPoint(t)) return ColumnType.POINT;
347
- else if (SpatialHelper.isLine(t)) return ColumnType.LINESTRING;
348
- return ColumnType.POLYGON;
349
- }
350
- static isMultiPoint(t) {
351
- return Array.isArray(t) && t[0] && SpatialHelper.isPoint(t[0]);
352
- }
353
- static isMultiLine(t) {
354
- return Array.isArray(t) && t[0] && SpatialHelper.isLine(t[0]);
355
- }
356
- static isMultiPolygon(t) {
357
- return Array.isArray(t) && t[0] && SpatialHelper.isPolygon(t[0]);
358
- }
359
- };
360
-
361
- //#endregion
362
21
  export { Column, ColumnInfoUtil, ColumnModel, Dao, DaoInfoUtil, DataSourceQualifier, Index, IndexInfoUtil, IndexModel, SpatialHelper, TABLE_CLAZZ_LIST, Table, TableInfoUtil, TableModel };
@@ -0,0 +1,38 @@
1
+ import { ColumnFormat, ColumnParams, ColumnTypeParams } from "@eggjs/tegg-types";
2
+
3
+ //#region src/model/ColumnModel.d.ts
4
+ declare class ColumnModel {
5
+ columnName: string;
6
+ propertyName: string;
7
+ type: ColumnTypeParams;
8
+ canNull: boolean;
9
+ default?: string;
10
+ comment?: string;
11
+ visible?: boolean;
12
+ autoIncrement?: boolean;
13
+ uniqueKey?: boolean;
14
+ primaryKey?: boolean;
15
+ collate?: string;
16
+ columnFormat?: ColumnFormat;
17
+ engineAttribute?: string;
18
+ secondaryEngineAttribute?: string;
19
+ constructor(params: {
20
+ columnName: string;
21
+ propertyName: string;
22
+ type: ColumnTypeParams;
23
+ canNull: boolean;
24
+ default?: string;
25
+ comment?: string;
26
+ visible?: boolean;
27
+ autoIncrement?: boolean;
28
+ uniqueKey?: boolean;
29
+ primaryKey?: boolean;
30
+ collate?: string;
31
+ columnFormat?: ColumnFormat;
32
+ engineAttribute?: string;
33
+ secondaryEngineAttribute?: string;
34
+ });
35
+ static build(property: string, type: ColumnTypeParams, params?: ColumnParams): ColumnModel;
36
+ }
37
+ //#endregion
38
+ export { ColumnModel };
@@ -0,0 +1,59 @@
1
+ import snakecase from "lodash.snakecase";
2
+
3
+ //#region src/model/ColumnModel.ts
4
+ var ColumnModel = class ColumnModel {
5
+ columnName;
6
+ propertyName;
7
+ type;
8
+ canNull;
9
+ default;
10
+ comment;
11
+ visible;
12
+ autoIncrement;
13
+ uniqueKey;
14
+ primaryKey;
15
+ collate;
16
+ columnFormat;
17
+ engineAttribute;
18
+ secondaryEngineAttribute;
19
+ constructor(params) {
20
+ this.columnName = params.columnName;
21
+ this.propertyName = params.propertyName;
22
+ this.type = params.type;
23
+ this.canNull = params.canNull;
24
+ this.default = params.default;
25
+ this.comment = params.comment;
26
+ this.visible = params.visible;
27
+ this.autoIncrement = params.autoIncrement;
28
+ this.uniqueKey = params.uniqueKey;
29
+ this.primaryKey = params.primaryKey;
30
+ this.collate = params.collate;
31
+ this.columnFormat = params.columnFormat;
32
+ this.engineAttribute = params.engineAttribute;
33
+ this.secondaryEngineAttribute = params.secondaryEngineAttribute;
34
+ }
35
+ static build(property, type, params) {
36
+ const columnName = params?.name ?? snakecase(property);
37
+ let canNull = params?.canNull ?? false;
38
+ if (params?.primaryKey) canNull = false;
39
+ return new ColumnModel({
40
+ columnName,
41
+ propertyName: property,
42
+ type,
43
+ canNull,
44
+ default: params?.default,
45
+ comment: params?.comment,
46
+ visible: params?.visible,
47
+ autoIncrement: params?.autoIncrement,
48
+ uniqueKey: params?.uniqueKey,
49
+ primaryKey: params?.primaryKey,
50
+ collate: params?.collate,
51
+ columnFormat: params?.columnFormat,
52
+ engineAttribute: params?.engineAttribute,
53
+ secondaryEngineAttribute: params?.secondaryEngineAttribute
54
+ });
55
+ }
56
+ };
57
+
58
+ //#endregion
59
+ export { ColumnModel };
@@ -0,0 +1,32 @@
1
+ import { ColumnModel } from "./ColumnModel.js";
2
+ import { EggProtoImplClass, IndexParams, IndexStoreType, IndexType } from "@eggjs/tegg-types";
3
+
4
+ //#region src/model/IndexModel.d.ts
5
+ interface IndexKey {
6
+ columnName: string;
7
+ propertyName: string;
8
+ }
9
+ declare class IndexModel {
10
+ name: string;
11
+ keys: IndexKey[];
12
+ type: IndexType;
13
+ storeType?: IndexStoreType;
14
+ comment?: string;
15
+ engineAttribute?: string;
16
+ secondaryEngineAttribute?: string;
17
+ parser?: string;
18
+ constructor(params: {
19
+ name: string;
20
+ keys: IndexKey[];
21
+ type: IndexType;
22
+ storeType?: IndexStoreType;
23
+ comment?: string;
24
+ engineAttribute?: string;
25
+ secondaryEngineAttribute?: string;
26
+ parser?: string;
27
+ });
28
+ static buildIndexName(keys: string[], type: IndexType): string;
29
+ static build(params: IndexParams, columns: ColumnModel[], clazz: EggProtoImplClass<unknown>): IndexModel;
30
+ }
31
+ //#endregion
32
+ export { IndexKey, IndexModel };
@@ -0,0 +1,51 @@
1
+ import "./ColumnModel.js";
2
+ import { IndexType } from "@eggjs/tegg-types";
3
+
4
+ //#region src/model/IndexModel.ts
5
+ var IndexModel = class IndexModel {
6
+ name;
7
+ keys;
8
+ type;
9
+ storeType;
10
+ comment;
11
+ engineAttribute;
12
+ secondaryEngineAttribute;
13
+ parser;
14
+ constructor(params) {
15
+ this.name = params.name;
16
+ this.keys = params.keys;
17
+ this.type = params.type;
18
+ this.storeType = params.storeType;
19
+ this.comment = params.comment;
20
+ this.engineAttribute = params.engineAttribute;
21
+ this.secondaryEngineAttribute = params.secondaryEngineAttribute;
22
+ this.parser = params.parser;
23
+ }
24
+ static buildIndexName(keys, type) {
25
+ return (type === IndexType.UNIQUE ? "uk_" : "idx_") + keys.join("_");
26
+ }
27
+ static build(params, columns, clazz) {
28
+ const type = params.type ?? IndexType.INDEX;
29
+ const keys = params.keys.map((t) => {
30
+ const column = columns.find((c) => c.propertyName === t);
31
+ if (!column) throw new Error(`Table ${clazz.name} index configuration error: has no property named "${t}"`);
32
+ return {
33
+ propertyName: column.propertyName,
34
+ columnName: column.columnName
35
+ };
36
+ });
37
+ return new IndexModel({
38
+ name: params.name ?? IndexModel.buildIndexName(keys.map((t) => t.columnName), type),
39
+ keys,
40
+ type,
41
+ storeType: params.storeType,
42
+ comment: params.comment,
43
+ engineAttribute: params.engineAttribute,
44
+ secondaryEngineAttribute: params.secondaryEngineAttribute,
45
+ parser: params.parser
46
+ });
47
+ }
48
+ };
49
+
50
+ //#endregion
51
+ export { IndexModel };
@@ -0,0 +1,55 @@
1
+ import { ColumnModel } from "./ColumnModel.js";
2
+ import { IndexModel } from "./IndexModel.js";
3
+ import { CompressionType, EggProtoImplClass, InsertMethod, RowFormat } from "@eggjs/tegg-types";
4
+
5
+ //#region src/model/TableModel.d.ts
6
+ declare class TableModel<T = object> {
7
+ clazz: EggProtoImplClass<T>;
8
+ name: string;
9
+ columns: Array<ColumnModel>;
10
+ indices: Array<IndexModel>;
11
+ dataSourceName: string;
12
+ comment?: string;
13
+ autoExtendSize?: number;
14
+ autoIncrement?: number;
15
+ avgRowLength?: number;
16
+ characterSet?: string;
17
+ collate?: string;
18
+ compression?: CompressionType;
19
+ encryption?: boolean;
20
+ engine?: string;
21
+ engineAttribute?: string;
22
+ insertMethod?: InsertMethod;
23
+ keyBlockSize?: number;
24
+ maxRows?: number;
25
+ minRows?: number;
26
+ rowFormat?: RowFormat;
27
+ secondaryEngineAttribute?: string;
28
+ constructor(params: {
29
+ clazz: EggProtoImplClass<T>;
30
+ name: string;
31
+ dataSourceName: string;
32
+ columns: Array<ColumnModel>;
33
+ indices: Array<IndexModel>;
34
+ comment?: string;
35
+ autoExtendSize?: number;
36
+ autoIncrement?: number;
37
+ avgRowLength?: number;
38
+ characterSet?: string;
39
+ collate?: string;
40
+ compression?: CompressionType;
41
+ encryption?: boolean;
42
+ engine?: string;
43
+ engineAttribute?: string;
44
+ insertMethod?: InsertMethod;
45
+ keyBlockSize?: number;
46
+ maxRows?: number;
47
+ minRows?: number;
48
+ rowFormat?: RowFormat;
49
+ secondaryEngineAttribute?: string;
50
+ });
51
+ getPrimary(): IndexModel | undefined;
52
+ static build<T>(clazz: EggProtoImplClass<T>): TableModel<T>;
53
+ }
54
+ //#endregion
55
+ export { TableModel };