oak-db 2.2.2 → 2.2.3
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 +36 -36
- package/lib/MySQL/connector.d.ts +15 -15
- package/lib/MySQL/connector.js +124 -124
- package/lib/MySQL/store.d.ts +32 -32
- package/lib/MySQL/store.js +404 -404
- package/lib/MySQL/translator.d.ts +105 -105
- package/lib/MySQL/translator.js +775 -775
- package/lib/MySQL/types/Configuration.d.ts +11 -11
- package/lib/MySQL/types/Configuration.js +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js +4 -4
- package/lib/sqlTranslator.d.ts +52 -52
- package/lib/sqlTranslator.js +895 -856
- package/lib/types/Translator.js +1 -1
- package/package.json +36 -36
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export declare type MySQLConfiguration = {
|
|
2
|
-
host: string;
|
|
3
|
-
user: string;
|
|
4
|
-
password: string;
|
|
5
|
-
database: string;
|
|
6
|
-
charset: 'utf8mb4_general_ci';
|
|
7
|
-
connectionLimit: number;
|
|
8
|
-
};
|
|
9
|
-
export declare type Configuration = {
|
|
10
|
-
mysql: MySQLConfiguration;
|
|
11
|
-
};
|
|
1
|
+
export declare type MySQLConfiguration = {
|
|
2
|
+
host: string;
|
|
3
|
+
user: string;
|
|
4
|
+
password: string;
|
|
5
|
+
database: string;
|
|
6
|
+
charset: 'utf8mb4_general_ci';
|
|
7
|
+
connectionLimit: number;
|
|
8
|
+
};
|
|
9
|
+
export declare type Configuration = {
|
|
10
|
+
mysql: MySQLConfiguration;
|
|
11
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './MySQL/store';
|
|
2
|
-
export { MySqlSelectOption, MysqlOperateOption } from './MySQL/translator';
|
|
1
|
+
export * from './MySQL/store';
|
|
2
|
+
export { MySqlSelectOption, MysqlOperateOption } from './MySQL/translator';
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./MySQL/store"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./MySQL/store"), exports);
|
package/lib/sqlTranslator.d.ts
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { EntityDict, OperateOption, Q_FullTextValue, Ref, RefOrExpression, SelectOption, StorageSchema } from "oak-domain/lib/types";
|
|
2
|
-
import { DataType } from "oak-domain/lib/types/schema/DataTypes";
|
|
3
|
-
export interface SqlSelectOption extends SelectOption {
|
|
4
|
-
}
|
|
5
|
-
export interface SqlOperateOption extends OperateOption {
|
|
6
|
-
}
|
|
7
|
-
export declare abstract class SqlTranslator<ED extends EntityDict> {
|
|
8
|
-
readonly schema: StorageSchema<ED>;
|
|
9
|
-
constructor(schema: StorageSchema<ED>);
|
|
10
|
-
private makeFullSchema;
|
|
11
|
-
protected abstract getDefaultSelectFilter<OP extends SqlSelectOption>(alias: string, option?: OP): string;
|
|
12
|
-
protected abstract translateAttrProjection(dataType: DataType, alias: string, attr: string): string;
|
|
13
|
-
protected abstract translateAttrValue(dataType: DataType | Ref, value: any): string;
|
|
14
|
-
protected abstract translateFullTextSearch<T extends keyof ED>(value: Q_FullTextValue, entity: T, alias: string): string;
|
|
15
|
-
abstract translateCreateEntity<T extends keyof ED>(entity: T, option: {
|
|
16
|
-
replace?: boolean;
|
|
17
|
-
}): string[];
|
|
18
|
-
protected abstract populateSelectStmt<T extends keyof ED, OP extends SqlSelectOption>(projectionText: string, fromText: string, aliasDict: Record<string, string>, filterText: string, sorterText?: string, groupByText?: string, indexFrom?: number, count?: number, option?: OP, selection?: ED[T]['Selection'], aggregation?: ED[T]['Aggregation']): string;
|
|
19
|
-
protected abstract populateUpdateStmt<OP extends SqlOperateOption>(updateText: string, fromText: string, aliasDict: Record<string, string>, filterText: string, sorterText?: string, indexFrom?: number, count?: number, option?: OP): string;
|
|
20
|
-
protected abstract populateRemoveStmt<OP extends SqlOperateOption>(removeText: string, fromText: string, aliasDict: Record<string, string>, filterText: string, sorterText?: string, indexFrom?: number, count?: number, option?: OP): string;
|
|
21
|
-
protected abstract translateExpression<T extends keyof ED>(entity: T, alias: string, expression: RefOrExpression<keyof ED[T]['OpSchema']>, refDict: Record<string, [string, keyof ED]>): string;
|
|
22
|
-
private getStorageName;
|
|
23
|
-
translateInsert<T extends keyof ED>(entity: T, data: ED[T]['CreateMulti']['data']): string;
|
|
24
|
-
/**
|
|
25
|
-
* analyze the join relations in projection/query/sort
|
|
26
|
-
* 所有的层次关系都当成left join处理,如果有内表为空的情况,请手动处理
|
|
27
|
-
* {
|
|
28
|
-
* b: {
|
|
29
|
-
* name: {
|
|
30
|
-
* $exists: false,
|
|
31
|
-
* }
|
|
32
|
-
* }
|
|
33
|
-
* }
|
|
34
|
-
* 这样的query会把内表为空的行也返回
|
|
35
|
-
* @param param0
|
|
36
|
-
*/
|
|
37
|
-
private analyzeJoin;
|
|
38
|
-
private translateComparison;
|
|
39
|
-
private translateElement;
|
|
40
|
-
private translateEvaluation;
|
|
41
|
-
private translateFilter;
|
|
42
|
-
private translateSorter;
|
|
43
|
-
private translateProjection;
|
|
44
|
-
private translateSelectInner;
|
|
45
|
-
translateSelect<T extends keyof ED, OP extends SqlSelectOption>(entity: T, selection: ED[T]['Selection'], option?: OP): string;
|
|
46
|
-
translateAggregate<T extends keyof ED, OP extends SqlSelectOption>(entity: T, aggregation: ED[T]['Aggregation'], option?: OP): string;
|
|
47
|
-
translateCount<T extends keyof ED, OP extends SqlSelectOption>(entity: T, selection: Pick<ED[T]['Selection'], 'filter' | 'count'>, option?: OP): string;
|
|
48
|
-
translateRemove<T extends keyof ED, OP extends SqlOperateOption>(entity: T, operation: ED[T]['Remove'], option?: OP): string;
|
|
49
|
-
translateUpdate<T extends keyof ED, OP extends SqlOperateOption>(entity: T, operation: ED[T]['Update'], option?: OP): string;
|
|
50
|
-
translateDestroyEntity(entity: string, truncate?: boolean): string;
|
|
51
|
-
escapeStringValue(value: string): string;
|
|
52
|
-
}
|
|
1
|
+
import { EntityDict, OperateOption, Q_FullTextValue, Ref, RefOrExpression, SelectOption, StorageSchema } from "oak-domain/lib/types";
|
|
2
|
+
import { DataType } from "oak-domain/lib/types/schema/DataTypes";
|
|
3
|
+
export interface SqlSelectOption extends SelectOption {
|
|
4
|
+
}
|
|
5
|
+
export interface SqlOperateOption extends OperateOption {
|
|
6
|
+
}
|
|
7
|
+
export declare abstract class SqlTranslator<ED extends EntityDict> {
|
|
8
|
+
readonly schema: StorageSchema<ED>;
|
|
9
|
+
constructor(schema: StorageSchema<ED>);
|
|
10
|
+
private makeFullSchema;
|
|
11
|
+
protected abstract getDefaultSelectFilter<OP extends SqlSelectOption>(alias: string, option?: OP): string;
|
|
12
|
+
protected abstract translateAttrProjection(dataType: DataType, alias: string, attr: string): string;
|
|
13
|
+
protected abstract translateAttrValue(dataType: DataType | Ref, value: any): string;
|
|
14
|
+
protected abstract translateFullTextSearch<T extends keyof ED>(value: Q_FullTextValue, entity: T, alias: string): string;
|
|
15
|
+
abstract translateCreateEntity<T extends keyof ED>(entity: T, option: {
|
|
16
|
+
replace?: boolean;
|
|
17
|
+
}): string[];
|
|
18
|
+
protected abstract populateSelectStmt<T extends keyof ED, OP extends SqlSelectOption>(projectionText: string, fromText: string, aliasDict: Record<string, string>, filterText: string, sorterText?: string, groupByText?: string, indexFrom?: number, count?: number, option?: OP, selection?: ED[T]['Selection'], aggregation?: ED[T]['Aggregation']): string;
|
|
19
|
+
protected abstract populateUpdateStmt<OP extends SqlOperateOption>(updateText: string, fromText: string, aliasDict: Record<string, string>, filterText: string, sorterText?: string, indexFrom?: number, count?: number, option?: OP): string;
|
|
20
|
+
protected abstract populateRemoveStmt<OP extends SqlOperateOption>(removeText: string, fromText: string, aliasDict: Record<string, string>, filterText: string, sorterText?: string, indexFrom?: number, count?: number, option?: OP): string;
|
|
21
|
+
protected abstract translateExpression<T extends keyof ED>(entity: T, alias: string, expression: RefOrExpression<keyof ED[T]['OpSchema']>, refDict: Record<string, [string, keyof ED]>): string;
|
|
22
|
+
private getStorageName;
|
|
23
|
+
translateInsert<T extends keyof ED>(entity: T, data: ED[T]['CreateMulti']['data']): string;
|
|
24
|
+
/**
|
|
25
|
+
* analyze the join relations in projection/query/sort
|
|
26
|
+
* 所有的层次关系都当成left join处理,如果有内表为空的情况,请手动处理
|
|
27
|
+
* {
|
|
28
|
+
* b: {
|
|
29
|
+
* name: {
|
|
30
|
+
* $exists: false,
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* 这样的query会把内表为空的行也返回
|
|
35
|
+
* @param param0
|
|
36
|
+
*/
|
|
37
|
+
private analyzeJoin;
|
|
38
|
+
private translateComparison;
|
|
39
|
+
private translateElement;
|
|
40
|
+
private translateEvaluation;
|
|
41
|
+
private translateFilter;
|
|
42
|
+
private translateSorter;
|
|
43
|
+
private translateProjection;
|
|
44
|
+
private translateSelectInner;
|
|
45
|
+
translateSelect<T extends keyof ED, OP extends SqlSelectOption>(entity: T, selection: ED[T]['Selection'], option?: OP): string;
|
|
46
|
+
translateAggregate<T extends keyof ED, OP extends SqlSelectOption>(entity: T, aggregation: ED[T]['Aggregation'], option?: OP): string;
|
|
47
|
+
translateCount<T extends keyof ED, OP extends SqlSelectOption>(entity: T, selection: Pick<ED[T]['Selection'], 'filter' | 'count'>, option?: OP): string;
|
|
48
|
+
translateRemove<T extends keyof ED, OP extends SqlOperateOption>(entity: T, operation: ED[T]['Remove'], option?: OP): string;
|
|
49
|
+
translateUpdate<T extends keyof ED, OP extends SqlOperateOption>(entity: T, operation: ED[T]['Update'], option?: OP): string;
|
|
50
|
+
translateDestroyEntity(entity: string, truncate?: boolean): string;
|
|
51
|
+
escapeStringValue(value: string): string;
|
|
52
|
+
}
|