tspace-mysql 1.3.0 → 1.3.2
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 +72 -14
- package/dist/cli/dump/db.d.ts +4 -4
- package/dist/cli/dump/db.js +25 -25
- package/dist/cli/generate/make.d.ts +4 -4
- package/dist/cli/generate/make.js +45 -45
- package/dist/cli/generate/model.d.ts +2 -2
- package/dist/cli/generate/model.js +6 -6
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +58 -58
- package/dist/cli/migrate/make.d.ts +4 -4
- package/dist/cli/migrate/make.js +30 -30
- package/dist/cli/models/make.d.ts +4 -4
- package/dist/cli/models/make.js +51 -51
- package/dist/cli/models/model.d.ts +2 -2
- package/dist/cli/models/model.js +20 -11
- package/dist/cli/query/index.d.ts +4 -4
- package/dist/cli/query/index.js +7 -7
- package/dist/cli/tables/make.d.ts +4 -4
- package/dist/cli/tables/make.js +26 -26
- package/dist/cli/tables/table.d.ts +2 -2
- package/dist/cli/tables/table.js +6 -6
- package/dist/lib/connection/index.d.ts +30 -30
- package/dist/lib/connection/index.js +144 -143
- package/dist/lib/connection/options.d.ts +15 -4
- package/dist/lib/connection/options.js +43 -42
- package/dist/lib/constants/index.d.ts +5 -8
- package/dist/lib/constants/index.js +162 -158
- package/dist/lib/index.d.ts +8 -8
- package/dist/lib/index.js +36 -36
- package/dist/lib/tspace/{AbstractDatabase.d.ts → AbstractBuilder.d.ts} +124 -116
- package/dist/lib/tspace/{AbstractDatabase.js → AbstractBuilder.js} +36 -34
- package/dist/lib/tspace/AbstractDB.d.ts +18 -18
- package/dist/lib/tspace/AbstractDB.js +11 -11
- package/dist/lib/tspace/AbstractModel.d.ts +43 -41
- package/dist/lib/tspace/AbstractModel.js +11 -11
- package/dist/lib/tspace/Blueprint.d.ts +136 -136
- package/dist/lib/tspace/Blueprint.js +228 -228
- package/dist/lib/tspace/{Database.d.ts → Builder.d.ts} +825 -706
- package/dist/lib/tspace/{Database.js → Builder.js} +2548 -2363
- package/dist/lib/tspace/DB.d.ts +152 -126
- package/dist/lib/tspace/DB.js +373 -264
- package/dist/lib/tspace/Interface.d.ts +110 -109
- package/dist/lib/tspace/Interface.js +2 -2
- package/dist/lib/tspace/Logger.d.ts +8 -8
- package/dist/lib/tspace/Logger.js +49 -49
- package/dist/lib/tspace/Model.d.ts +708 -609
- package/dist/lib/tspace/Model.js +2519 -2477
- package/dist/lib/tspace/ProxyHandler.d.ts +14 -14
- package/dist/lib/tspace/ProxyHandler.js +31 -31
- package/dist/lib/tspace/Schema.d.ts +8 -8
- package/dist/lib/tspace/Schema.js +45 -44
- package/dist/lib/tspace/index.d.ts +15 -15
- package/dist/lib/tspace/index.js +20 -20
- package/dist/lib/utils/index.d.ts +15 -15
- package/dist/lib/utils/index.js +155 -165
- package/package.json +2 -4
package/dist/lib/tspace/DB.d.ts
CHANGED
|
@@ -1,126 +1,152 @@
|
|
|
1
|
-
import { AbstractDB } from './AbstractDB';
|
|
2
|
-
import { Connection, ConnectionOptions, ConnectionTransaction } from './Interface';
|
|
3
|
-
declare class DB extends AbstractDB {
|
|
4
|
-
constructor(table?: string);
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
* @
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
* @
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
* @
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*
|
|
36
|
-
* @
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*
|
|
44
|
-
* @
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*
|
|
55
|
-
* @
|
|
56
|
-
* @
|
|
57
|
-
* @
|
|
58
|
-
* @
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
*
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
*
|
|
72
|
-
* @param {
|
|
73
|
-
* @return {
|
|
74
|
-
*/
|
|
75
|
-
static
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
*
|
|
81
|
-
* @
|
|
82
|
-
* @
|
|
83
|
-
* @
|
|
84
|
-
*/
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
*
|
|
88
|
-
* @static
|
|
89
|
-
* @
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
*
|
|
95
|
-
* @
|
|
96
|
-
* @
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
*
|
|
106
|
-
* @
|
|
107
|
-
* @
|
|
108
|
-
* @
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
*
|
|
114
|
-
* @
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
*
|
|
119
|
-
* @
|
|
120
|
-
* @
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
1
|
+
import { AbstractDB } from './AbstractDB';
|
|
2
|
+
import { Connection, ConnectionOptions, ConnectionTransaction } from './Interface';
|
|
3
|
+
declare class DB extends AbstractDB {
|
|
4
|
+
constructor(table?: string);
|
|
5
|
+
union(a: string, b: string): Promise<any[]>;
|
|
6
|
+
/**
|
|
7
|
+
* Covert result to array
|
|
8
|
+
* @param {any} result table name
|
|
9
|
+
* @return {Array} array
|
|
10
|
+
*/
|
|
11
|
+
makeArray(result: any): Array<any>;
|
|
12
|
+
/**
|
|
13
|
+
* Covert result to object or null
|
|
14
|
+
* @param {any} result table name
|
|
15
|
+
* @return {Record | null} object or null
|
|
16
|
+
*/
|
|
17
|
+
makeObject(result: any): Record<string, any> | null;
|
|
18
|
+
/**
|
|
19
|
+
* Assign table name
|
|
20
|
+
* @param {string} table table name
|
|
21
|
+
* @return {this} this
|
|
22
|
+
*/
|
|
23
|
+
table(table: string): this;
|
|
24
|
+
/**
|
|
25
|
+
* Get constant
|
|
26
|
+
* @param {string} constant
|
|
27
|
+
* @return {string | object} string || object
|
|
28
|
+
*/
|
|
29
|
+
constants(constant?: string): string | {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* cases query
|
|
34
|
+
* @param {arrayObject} cases array object {when , then }
|
|
35
|
+
* @param {string?} final else condition
|
|
36
|
+
* @return {string} string
|
|
37
|
+
*/
|
|
38
|
+
caseUpdate(cases: {
|
|
39
|
+
when: string;
|
|
40
|
+
then: string;
|
|
41
|
+
}[], final?: string): string | [];
|
|
42
|
+
/**
|
|
43
|
+
* generate UUID
|
|
44
|
+
* @return {string} string
|
|
45
|
+
*/
|
|
46
|
+
generateUUID(): string;
|
|
47
|
+
/**
|
|
48
|
+
* Assign raw query for schema validation
|
|
49
|
+
* @param {string} sql
|
|
50
|
+
* @return {string} string
|
|
51
|
+
*/
|
|
52
|
+
raw(sql: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* Get a pool connection
|
|
55
|
+
* @param {Object} options options for connection database with credentials
|
|
56
|
+
* @param {string} option.host
|
|
57
|
+
* @param {number} option.port
|
|
58
|
+
* @param {string} option.database
|
|
59
|
+
* @param {string} option.username
|
|
60
|
+
* @param {string} option.password
|
|
61
|
+
* @return {Connection}
|
|
62
|
+
*/
|
|
63
|
+
getConnection(options: ConnectionOptions): Connection;
|
|
64
|
+
/**
|
|
65
|
+
* Covert result to array
|
|
66
|
+
* @param {any} result table name
|
|
67
|
+
* @return {Array} array
|
|
68
|
+
*/
|
|
69
|
+
static makeArray(result: any): any[];
|
|
70
|
+
/**
|
|
71
|
+
* Covert result to object | null
|
|
72
|
+
* @param {any} result table name
|
|
73
|
+
* @return {Record | null} object | null
|
|
74
|
+
*/
|
|
75
|
+
static makeObject(result: any): Record<string, any> | null;
|
|
76
|
+
/**
|
|
77
|
+
* Get a connection
|
|
78
|
+
* @return {ConnectionTransaction} object - Connection for the transaction
|
|
79
|
+
* @type {object} connection
|
|
80
|
+
* @property {function} connection.query - execute query sql then release connection to pool
|
|
81
|
+
* @property {function} connection.startTransaction - start transaction of query
|
|
82
|
+
* @property {function} connection.commit - commit transaction of query
|
|
83
|
+
* @property {function} connection.rollback - rollback transaction of query
|
|
84
|
+
*/
|
|
85
|
+
beginTransaction(): Promise<ConnectionTransaction>;
|
|
86
|
+
/**
|
|
87
|
+
* Assign table name
|
|
88
|
+
* @static
|
|
89
|
+
* @param {string} table table name
|
|
90
|
+
* @return {DB} DB
|
|
91
|
+
*/
|
|
92
|
+
static table(table: string): DB;
|
|
93
|
+
/**
|
|
94
|
+
* select by cases
|
|
95
|
+
* @static
|
|
96
|
+
* @param {arrayObject} cases array object {when , then }
|
|
97
|
+
* @param {string?} final else condition
|
|
98
|
+
* @return {this}
|
|
99
|
+
*/
|
|
100
|
+
static caseUpdate(cases: {
|
|
101
|
+
when: string;
|
|
102
|
+
then: string;
|
|
103
|
+
}[], final?: string): string | [];
|
|
104
|
+
/**
|
|
105
|
+
* Assign raw query for schema validation
|
|
106
|
+
* @static
|
|
107
|
+
* @param {string} sql
|
|
108
|
+
* @return {string} string
|
|
109
|
+
*/
|
|
110
|
+
static raw(sql: string): string;
|
|
111
|
+
/**
|
|
112
|
+
* generate UUID
|
|
113
|
+
* @static
|
|
114
|
+
* @return {string} string
|
|
115
|
+
*/
|
|
116
|
+
static generateUUID(): string;
|
|
117
|
+
/**
|
|
118
|
+
* Get constant
|
|
119
|
+
* @static
|
|
120
|
+
* @param {string} constant
|
|
121
|
+
* @return {string | object} string || object
|
|
122
|
+
*/
|
|
123
|
+
static constants(constant?: string): string | {
|
|
124
|
+
[key: string]: any;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Get a connection
|
|
128
|
+
* @static
|
|
129
|
+
* @return {ConnectionTransaction} object - Connection for the transaction
|
|
130
|
+
* @type {object} connection
|
|
131
|
+
* @property {function} connection.query - execute query sql then release connection to pool
|
|
132
|
+
* @property {function} connection.startTransaction - start transaction of query
|
|
133
|
+
* @property {function} connection.commit - commit transaction of query
|
|
134
|
+
* @property {function} connection.rollback - rollback transaction of query
|
|
135
|
+
*/
|
|
136
|
+
static beginTransaction(): Promise<ConnectionTransaction>;
|
|
137
|
+
/**
|
|
138
|
+
* Get a pool connection
|
|
139
|
+
* @param {Object} options options for connection database with credentials
|
|
140
|
+
* @param {string} option.host
|
|
141
|
+
* @param {number} option.port
|
|
142
|
+
* @param {string} option.database
|
|
143
|
+
* @param {string} option.username
|
|
144
|
+
* @param {string} option.password
|
|
145
|
+
* @return {Connection}
|
|
146
|
+
*/
|
|
147
|
+
static getConnection(options: ConnectionOptions): Connection;
|
|
148
|
+
private _typeOf;
|
|
149
|
+
private _initialDB;
|
|
150
|
+
}
|
|
151
|
+
export { DB };
|
|
152
|
+
export default DB;
|