oak-db 3.3.11 → 3.3.13
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/lib/MySQL/connector.d.ts +15 -15
- package/lib/MySQL/connector.js +77 -77
- package/lib/MySQL/store.d.ts +50 -37
- package/lib/MySQL/store.js +430 -308
- package/lib/MySQL/translator.d.ts +114 -107
- package/lib/MySQL/translator.js +307 -67
- package/lib/MySQL/types/Configuration.d.ts +12 -12
- package/lib/MySQL/types/Configuration.js +2 -2
- package/lib/PostgreSQL/connector.d.ts +27 -0
- package/lib/PostgreSQL/connector.js +147 -0
- package/lib/PostgreSQL/store.d.ts +50 -0
- package/lib/PostgreSQL/store.js +527 -0
- package/lib/PostgreSQL/translator.d.ts +103 -0
- package/lib/PostgreSQL/translator.js +2159 -0
- package/lib/PostgreSQL/types/Configuration.d.ts +13 -0
- package/lib/PostgreSQL/types/Configuration.js +2 -0
- package/lib/index.d.ts +4 -2
- package/lib/index.js +5 -4
- package/lib/sqlTranslator.d.ts +68 -55
- package/lib/sqlTranslator.js +1034 -999
- package/lib/types/Translator.d.ts +3 -3
- package/lib/types/Translator.js +2 -2
- package/lib/types/configuration.d.ts +7 -0
- package/lib/types/configuration.js +2 -0
- package/lib/types/dbStore.d.ts +32 -0
- package/lib/types/dbStore.js +3 -0
- package/package.json +6 -5
|
@@ -1,107 +1,114 @@
|
|
|
1
|
-
import { EntityDict, Q_FullTextValue, RefOrExpression, Ref, StorageSchema } from "oak-domain/lib/types";
|
|
2
|
-
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
|
3
|
-
import { DataType } from "oak-domain/lib/types/schema/DataTypes";
|
|
4
|
-
import { SqlOperateOption, SqlSelectOption, SqlTranslator } from "../sqlTranslator";
|
|
5
|
-
import { CreateEntityOption } from '../types/Translator';
|
|
6
|
-
export interface MySqlSelectOption extends SqlSelectOption {
|
|
7
|
-
}
|
|
8
|
-
export interface MysqlOperateOption extends SqlOperateOption {
|
|
9
|
-
}
|
|
10
|
-
export declare class MySqlTranslator<ED extends EntityDict & BaseEntityDict> extends SqlTranslator<ED> {
|
|
11
|
-
protected getDefaultSelectFilter(alias: string, option?: MySqlSelectOption): string;
|
|
12
|
-
private makeUpSchema;
|
|
13
|
-
constructor(schema: StorageSchema<ED>);
|
|
14
|
-
static supportedDataTypes: DataType[];
|
|
15
|
-
static spatialTypes: DataType[];
|
|
16
|
-
static withLengthDataTypes: DataType[];
|
|
17
|
-
static withPrecisionDataTypes: DataType[];
|
|
18
|
-
static withScaleDataTypes: DataType[];
|
|
19
|
-
static unsignedAndZerofillTypes: DataType[];
|
|
20
|
-
static withWidthDataTypes: DataType[];
|
|
21
|
-
static dataTypeDefaults: {
|
|
22
|
-
varchar: {
|
|
23
|
-
length: number;
|
|
24
|
-
};
|
|
25
|
-
nvarchar: {
|
|
26
|
-
length: number;
|
|
27
|
-
};
|
|
28
|
-
"national varchar": {
|
|
29
|
-
length: number;
|
|
30
|
-
};
|
|
31
|
-
char: {
|
|
32
|
-
length: number;
|
|
33
|
-
};
|
|
34
|
-
binary: {
|
|
35
|
-
length: number;
|
|
36
|
-
};
|
|
37
|
-
varbinary: {
|
|
38
|
-
length: number;
|
|
39
|
-
};
|
|
40
|
-
decimal: {
|
|
41
|
-
precision: number;
|
|
42
|
-
scale: number;
|
|
43
|
-
};
|
|
44
|
-
dec: {
|
|
45
|
-
precision: number;
|
|
46
|
-
scale: number;
|
|
47
|
-
};
|
|
48
|
-
numeric: {
|
|
49
|
-
precision: number;
|
|
50
|
-
scale: number;
|
|
51
|
-
};
|
|
52
|
-
fixed: {
|
|
53
|
-
precision: number;
|
|
54
|
-
scale: number;
|
|
55
|
-
};
|
|
56
|
-
float: {
|
|
57
|
-
precision: number;
|
|
58
|
-
};
|
|
59
|
-
double: {
|
|
60
|
-
precision: number;
|
|
61
|
-
};
|
|
62
|
-
time: {
|
|
63
|
-
precision: number;
|
|
64
|
-
};
|
|
65
|
-
datetime: {
|
|
66
|
-
precision: number;
|
|
67
|
-
};
|
|
68
|
-
timestamp: {
|
|
69
|
-
precision: number;
|
|
70
|
-
};
|
|
71
|
-
bit: {
|
|
72
|
-
width: number;
|
|
73
|
-
};
|
|
74
|
-
int: {
|
|
75
|
-
width: number;
|
|
76
|
-
};
|
|
77
|
-
integer: {
|
|
78
|
-
width: number;
|
|
79
|
-
};
|
|
80
|
-
tinyint: {
|
|
81
|
-
width: number;
|
|
82
|
-
};
|
|
83
|
-
smallint: {
|
|
84
|
-
width: number;
|
|
85
|
-
};
|
|
86
|
-
mediumint: {
|
|
87
|
-
width: number;
|
|
88
|
-
};
|
|
89
|
-
bigint: {
|
|
90
|
-
width: number;
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
maxAliasLength: number;
|
|
94
|
-
private populateDataTypeDef;
|
|
95
|
-
protected translateAttrProjection(dataType: DataType, alias: string, attr: string): string;
|
|
96
|
-
protected translateObjectPredicate(predicate: Record<string, any>, alias: string, attr: string): string;
|
|
97
|
-
protected translateObjectProjection(projection: Record<string, any>, alias: string, attr: string, prefix: string): string;
|
|
98
|
-
protected translateAttrValue(dataType: DataType | Ref, value: any): string;
|
|
99
|
-
protected translateFullTextSearch<T extends keyof ED>(value: Q_FullTextValue, entity: T, alias: string): string;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
private
|
|
103
|
-
|
|
104
|
-
protected
|
|
105
|
-
protected
|
|
106
|
-
protected
|
|
107
|
-
|
|
1
|
+
import { EntityDict, Q_FullTextValue, RefOrExpression, Ref, StorageSchema, Attribute } from "oak-domain/lib/types";
|
|
2
|
+
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
|
3
|
+
import { DataType } from "oak-domain/lib/types/schema/DataTypes";
|
|
4
|
+
import { SqlOperateOption, SqlSelectOption, SqlTranslator } from "../sqlTranslator";
|
|
5
|
+
import { CreateEntityOption } from '../types/Translator';
|
|
6
|
+
export interface MySqlSelectOption extends SqlSelectOption {
|
|
7
|
+
}
|
|
8
|
+
export interface MysqlOperateOption extends SqlOperateOption {
|
|
9
|
+
}
|
|
10
|
+
export declare class MySqlTranslator<ED extends EntityDict & BaseEntityDict> extends SqlTranslator<ED> {
|
|
11
|
+
protected getDefaultSelectFilter(alias: string, option?: MySqlSelectOption): string;
|
|
12
|
+
private makeUpSchema;
|
|
13
|
+
constructor(schema: StorageSchema<ED>);
|
|
14
|
+
static supportedDataTypes: DataType[];
|
|
15
|
+
static spatialTypes: DataType[];
|
|
16
|
+
static withLengthDataTypes: DataType[];
|
|
17
|
+
static withPrecisionDataTypes: DataType[];
|
|
18
|
+
static withScaleDataTypes: DataType[];
|
|
19
|
+
static unsignedAndZerofillTypes: DataType[];
|
|
20
|
+
static withWidthDataTypes: DataType[];
|
|
21
|
+
static dataTypeDefaults: {
|
|
22
|
+
varchar: {
|
|
23
|
+
length: number;
|
|
24
|
+
};
|
|
25
|
+
nvarchar: {
|
|
26
|
+
length: number;
|
|
27
|
+
};
|
|
28
|
+
"national varchar": {
|
|
29
|
+
length: number;
|
|
30
|
+
};
|
|
31
|
+
char: {
|
|
32
|
+
length: number;
|
|
33
|
+
};
|
|
34
|
+
binary: {
|
|
35
|
+
length: number;
|
|
36
|
+
};
|
|
37
|
+
varbinary: {
|
|
38
|
+
length: number;
|
|
39
|
+
};
|
|
40
|
+
decimal: {
|
|
41
|
+
precision: number;
|
|
42
|
+
scale: number;
|
|
43
|
+
};
|
|
44
|
+
dec: {
|
|
45
|
+
precision: number;
|
|
46
|
+
scale: number;
|
|
47
|
+
};
|
|
48
|
+
numeric: {
|
|
49
|
+
precision: number;
|
|
50
|
+
scale: number;
|
|
51
|
+
};
|
|
52
|
+
fixed: {
|
|
53
|
+
precision: number;
|
|
54
|
+
scale: number;
|
|
55
|
+
};
|
|
56
|
+
float: {
|
|
57
|
+
precision: number;
|
|
58
|
+
};
|
|
59
|
+
double: {
|
|
60
|
+
precision: number;
|
|
61
|
+
};
|
|
62
|
+
time: {
|
|
63
|
+
precision: number;
|
|
64
|
+
};
|
|
65
|
+
datetime: {
|
|
66
|
+
precision: number;
|
|
67
|
+
};
|
|
68
|
+
timestamp: {
|
|
69
|
+
precision: number;
|
|
70
|
+
};
|
|
71
|
+
bit: {
|
|
72
|
+
width: number;
|
|
73
|
+
};
|
|
74
|
+
int: {
|
|
75
|
+
width: number;
|
|
76
|
+
};
|
|
77
|
+
integer: {
|
|
78
|
+
width: number;
|
|
79
|
+
};
|
|
80
|
+
tinyint: {
|
|
81
|
+
width: number;
|
|
82
|
+
};
|
|
83
|
+
smallint: {
|
|
84
|
+
width: number;
|
|
85
|
+
};
|
|
86
|
+
mediumint: {
|
|
87
|
+
width: number;
|
|
88
|
+
};
|
|
89
|
+
bigint: {
|
|
90
|
+
width: number;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
maxAliasLength: number;
|
|
94
|
+
private populateDataTypeDef;
|
|
95
|
+
protected translateAttrProjection(dataType: DataType, alias: string, attr: string): string;
|
|
96
|
+
protected translateObjectPredicate(predicate: Record<string, any>, alias: string, attr: string): string;
|
|
97
|
+
protected translateObjectProjection(projection: Record<string, any>, alias: string, attr: string, prefix: string): string;
|
|
98
|
+
protected translateAttrValue(dataType: DataType | Ref, value: any): string;
|
|
99
|
+
protected translateFullTextSearch<T extends keyof ED>(value: Q_FullTextValue, entity: T, alias: string): string;
|
|
100
|
+
translateAttributeDef(attr: string, attrDef: Attribute): string;
|
|
101
|
+
translateCreateEntity<T extends keyof ED>(entity: T, options?: CreateEntityOption): string[];
|
|
102
|
+
private translateFnName;
|
|
103
|
+
private translateAttrInExpression;
|
|
104
|
+
protected translateExpression<T extends keyof ED>(entity: T, alias: string, expression: RefOrExpression<keyof ED[T]["OpSchema"]>, refDict: Record<string, [string, keyof ED]>): string;
|
|
105
|
+
protected populateSelectStmt<T extends keyof ED>(projectionText: string, fromText: string, aliasDict: Record<string, string>, filterText: string, sorterText?: string, groupByText?: string, indexFrom?: number, count?: number, option?: MySqlSelectOption): string;
|
|
106
|
+
protected populateUpdateStmt(updateText: string, fromText: string, aliasDict: Record<string, string>, filterText: string, sorterText?: string, indexFrom?: number, count?: number, option?: MysqlOperateOption): string;
|
|
107
|
+
protected populateRemoveStmt(updateText: string, fromText: string, aliasDict: Record<string, string>, filterText: string, sorterText?: string, indexFrom?: number, count?: number, option?: MysqlOperateOption): string;
|
|
108
|
+
/**
|
|
109
|
+
* 将MySQL返回的Type回译成oak的类型,是 populateDataTypeDef 的反函数
|
|
110
|
+
* @param type
|
|
111
|
+
*/
|
|
112
|
+
private reTranslateToAttribute;
|
|
113
|
+
readSchema(execFn: (sql: string) => Promise<any>): Promise<StorageSchema<ED>>;
|
|
114
|
+
}
|