@axiosleo/orm-mysql 0.8.3 → 0.8.4
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/index.d.ts +16 -2
- package/package.json +1 -1
- package/src/client.js +5 -2
package/index.d.ts
CHANGED
|
@@ -255,13 +255,27 @@ export declare class Builder {
|
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
export declare class MySQLClient extends QueryHandler {
|
|
258
|
+
|
|
258
259
|
constructor(options?: ConnectionOptions, name?: string | null | undefined);
|
|
259
260
|
|
|
261
|
+
/**
|
|
262
|
+
* @param database default is options.database
|
|
263
|
+
*/
|
|
260
264
|
existDatabase(database?: string): Promise<boolean>;
|
|
261
265
|
|
|
262
|
-
|
|
266
|
+
/**
|
|
267
|
+
* @param table
|
|
268
|
+
* @param database default is options.database
|
|
269
|
+
*/
|
|
270
|
+
existTable(table: string, database?: string): Promise<boolean>;
|
|
263
271
|
|
|
264
|
-
|
|
272
|
+
/**
|
|
273
|
+
*
|
|
274
|
+
* @param query
|
|
275
|
+
* @param operator default is 'select'
|
|
276
|
+
*/
|
|
277
|
+
execQuery(query: Query, operator?: OperatorType): Promise<QueryResult>;
|
|
265
278
|
|
|
266
279
|
close(): Promise<void>;
|
|
280
|
+
|
|
267
281
|
}
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -102,7 +102,10 @@ class MySQLClient extends QueryHandler {
|
|
|
102
102
|
super(conn);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
async existTable(
|
|
105
|
+
async existTable(table, database = null) {
|
|
106
|
+
if (!table) {
|
|
107
|
+
throw new Error('table name is required');
|
|
108
|
+
}
|
|
106
109
|
const c = await this.table('information_schema.TABLES')
|
|
107
110
|
.where('TABLE_SCHEMA', database)
|
|
108
111
|
.where('TABLE_NAME', table)
|
|
@@ -120,7 +123,7 @@ class MySQLClient extends QueryHandler {
|
|
|
120
123
|
/**
|
|
121
124
|
* @param {import('./operator').Query} query
|
|
122
125
|
*/
|
|
123
|
-
async
|
|
126
|
+
async execQuery(query, operator = null) {
|
|
124
127
|
if (query instanceof Query) {
|
|
125
128
|
query.options.operator = operator;
|
|
126
129
|
return await _query(this.conn, query.options);
|