tspace-mysql 1.4.4 → 1.4.6
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 +112 -90
- package/dist/lib/connection/index.d.ts +1 -1
- package/dist/lib/connection/index.js +9 -10
- package/dist/lib/connection/options.js +1 -1
- package/dist/lib/constants/index.js +3 -2
- package/dist/lib/tspace/Abstract/AbstractBuilder.d.ts +41 -42
- package/dist/lib/tspace/Abstract/AbstractDB.d.ts +2 -4
- package/dist/lib/tspace/Abstract/AbstractModel.d.ts +5 -7
- package/dist/lib/tspace/Blueprint.d.ts +9 -3
- package/dist/lib/tspace/Blueprint.js +15 -8
- package/dist/lib/tspace/Builder.d.ts +92 -96
- package/dist/lib/tspace/Builder.js +220 -142
- package/dist/lib/tspace/Model.d.ts +45 -139
- package/dist/lib/tspace/Model.js +78 -180
- package/dist/lib/tspace/Schema.js +7 -5
- package/package.json +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Make schema for table with Blueprint
|
|
3
3
|
* @example
|
|
4
4
|
* import { Schema , Blueprint } from 'tspace-mysql'
|
|
5
5
|
* await new Schema().table('persos1',{
|
|
6
6
|
* id : new Blueprint().int().notNull().primary().autoIncrement(),
|
|
7
|
-
* name : new Blueprint().varchar(255).default('my name
|
|
7
|
+
* name : new Blueprint().varchar(255).default('my name'),
|
|
8
8
|
* email : new Blueprint().varchar(255).unique(),
|
|
9
|
+
* json : new Blueprint().json().null(),
|
|
9
10
|
* verify : new Blueprint().tinyInt(1).notNull(),
|
|
10
11
|
* created_at : new Blueprint().timestamp().null(),
|
|
11
12
|
* updated_at : new Blueprint().timestamp().null(),
|
|
@@ -20,7 +21,7 @@ declare class Blueprint {
|
|
|
20
21
|
* Assign type 'int' in table
|
|
21
22
|
* @return {this} this
|
|
22
23
|
*/
|
|
23
|
-
int(): this;
|
|
24
|
+
int(number?: number): this;
|
|
24
25
|
/**
|
|
25
26
|
* Assign type 'TINYINT' in table
|
|
26
27
|
* @param {number} number
|
|
@@ -186,6 +187,11 @@ declare class Blueprint {
|
|
|
186
187
|
* @return {this} this
|
|
187
188
|
*/
|
|
188
189
|
autoIncrement(): this;
|
|
190
|
+
/**
|
|
191
|
+
* Assign attributes 'autoIncrement' in table
|
|
192
|
+
* @return {this} this
|
|
193
|
+
*/
|
|
194
|
+
autoincrement(): this;
|
|
189
195
|
private _addAssignType;
|
|
190
196
|
private _addAssignAttribute;
|
|
191
197
|
}
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Blueprint = void 0;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Make schema for table with Blueprint
|
|
6
6
|
* @example
|
|
7
7
|
* import { Schema , Blueprint } from 'tspace-mysql'
|
|
8
8
|
* await new Schema().table('persos1',{
|
|
9
9
|
* id : new Blueprint().int().notNull().primary().autoIncrement(),
|
|
10
|
-
* name : new Blueprint().varchar(255).default('my name
|
|
10
|
+
* name : new Blueprint().varchar(255).default('my name'),
|
|
11
11
|
* email : new Blueprint().varchar(255).unique(),
|
|
12
|
+
* json : new Blueprint().json().null(),
|
|
12
13
|
* verify : new Blueprint().tinyInt(1).notNull(),
|
|
13
14
|
* created_at : new Blueprint().timestamp().null(),
|
|
14
15
|
* updated_at : new Blueprint().timestamp().null(),
|
|
@@ -17,7 +18,7 @@ exports.Blueprint = void 0;
|
|
|
17
18
|
*/
|
|
18
19
|
class Blueprint {
|
|
19
20
|
constructor() {
|
|
20
|
-
this.type = '';
|
|
21
|
+
this.type = 'INT';
|
|
21
22
|
this.attributes = [];
|
|
22
23
|
this.valueType = String;
|
|
23
24
|
}
|
|
@@ -25,7 +26,7 @@ class Blueprint {
|
|
|
25
26
|
* Assign type 'int' in table
|
|
26
27
|
* @return {this} this
|
|
27
28
|
*/
|
|
28
|
-
int() {
|
|
29
|
+
int(number) {
|
|
29
30
|
this._addAssignType('INT');
|
|
30
31
|
this.valueType = Number;
|
|
31
32
|
return this;
|
|
@@ -305,14 +306,20 @@ class Blueprint {
|
|
|
305
306
|
this._addAssignAttribute(`AUTO_INCREMENT`);
|
|
306
307
|
return this;
|
|
307
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* Assign attributes 'autoIncrement' in table
|
|
311
|
+
* @return {this} this
|
|
312
|
+
*/
|
|
313
|
+
autoincrement() {
|
|
314
|
+
this._addAssignAttribute(`AUTO_INCREMENT`);
|
|
315
|
+
return this;
|
|
316
|
+
}
|
|
308
317
|
_addAssignType(type) {
|
|
309
|
-
if (this.type)
|
|
310
|
-
return this;
|
|
311
318
|
this.type = type;
|
|
312
319
|
return this;
|
|
313
320
|
}
|
|
314
|
-
_addAssignAttribute(
|
|
315
|
-
this.attributes = [...this.attributes,
|
|
321
|
+
_addAssignAttribute(attribute) {
|
|
322
|
+
this.attributes = [...this.attributes, attribute];
|
|
316
323
|
return this;
|
|
317
324
|
}
|
|
318
325
|
}
|
|
@@ -13,7 +13,7 @@ declare class Builder extends AbstractBuilder {
|
|
|
13
13
|
* @param {...string} columns
|
|
14
14
|
* @return {this} this
|
|
15
15
|
*/
|
|
16
|
-
except(...columns:
|
|
16
|
+
except(...columns: string[]): this;
|
|
17
17
|
/**
|
|
18
18
|
* data alaways will return void
|
|
19
19
|
* @return {this} this
|
|
@@ -24,20 +24,19 @@ declare class Builder extends AbstractBuilder {
|
|
|
24
24
|
* @param {...string} columns show only colums selected
|
|
25
25
|
* @return {this} this
|
|
26
26
|
*/
|
|
27
|
-
only(...columns:
|
|
27
|
+
only(...columns: string[]): this;
|
|
28
28
|
/**
|
|
29
29
|
*
|
|
30
|
-
* @param {string=} column [column=id]
|
|
31
30
|
* @return {this} this
|
|
32
31
|
*/
|
|
33
|
-
distinct(
|
|
32
|
+
distinct(): this;
|
|
34
33
|
/**
|
|
35
34
|
* select data form table
|
|
36
|
-
* @param {
|
|
35
|
+
* @param {string[]} ...columns
|
|
37
36
|
* @return {this} this
|
|
38
37
|
*/
|
|
39
|
-
select(...columns:
|
|
40
|
-
selectRaw(...columns:
|
|
38
|
+
select(...columns: string[]): this;
|
|
39
|
+
selectRaw(...columns: string[]): this;
|
|
41
40
|
/**
|
|
42
41
|
* chunks data from array
|
|
43
42
|
* @param {number} chunk
|
|
@@ -63,20 +62,18 @@ declare class Builder extends AbstractBuilder {
|
|
|
63
62
|
* @param {Object} columns
|
|
64
63
|
* @return {this}
|
|
65
64
|
*/
|
|
66
|
-
whereObject(columns:
|
|
67
|
-
[key: string]: any;
|
|
68
|
-
}): this;
|
|
65
|
+
whereObject(columns: Record<string, any>): this;
|
|
69
66
|
/**
|
|
70
67
|
* where json target to key in json values default operator '='
|
|
68
|
+
* @param {string} column
|
|
71
69
|
* @param {object} property
|
|
72
|
-
* @property {string} property.column
|
|
73
70
|
* @property {string} property.targetKey
|
|
74
71
|
* @property {string} property.value
|
|
75
72
|
* @property {string?} property.operator
|
|
73
|
+
* @example
|
|
76
74
|
* @return {this}
|
|
77
75
|
*/
|
|
78
|
-
|
|
79
|
-
column: string;
|
|
76
|
+
whereJSON(column: string, { targetKey, value, operator }: {
|
|
80
77
|
targetKey: string;
|
|
81
78
|
value: string;
|
|
82
79
|
operator?: string;
|
|
@@ -133,28 +130,28 @@ declare class Builder extends AbstractBuilder {
|
|
|
133
130
|
* @param {array} array
|
|
134
131
|
* @return {this}
|
|
135
132
|
*/
|
|
136
|
-
whereIn(column: string, array:
|
|
133
|
+
whereIn(column: string, array: any[]): this;
|
|
137
134
|
/**
|
|
138
135
|
* or where in data using array values
|
|
139
136
|
* @param {string} column
|
|
140
137
|
* @param {array} array
|
|
141
138
|
* @return {this}
|
|
142
139
|
*/
|
|
143
|
-
orWhereIn(column: string, array:
|
|
140
|
+
orWhereIn(column: string, array: any[]): this;
|
|
144
141
|
/**
|
|
145
142
|
* where not in data using array values
|
|
146
143
|
* @param {string} column
|
|
147
144
|
* @param {array} array
|
|
148
145
|
* @return {this}
|
|
149
146
|
*/
|
|
150
|
-
whereNotIn(column: string, array:
|
|
147
|
+
whereNotIn(column: string, array: any[]): this;
|
|
151
148
|
/**
|
|
152
149
|
* where not in data using array values
|
|
153
150
|
* @param {string} column
|
|
154
151
|
* @param {array} array
|
|
155
152
|
* @return {this}
|
|
156
153
|
*/
|
|
157
|
-
orWhereNotIn(column: string, array:
|
|
154
|
+
orWhereNotIn(column: string, array: any[]): this;
|
|
158
155
|
/**
|
|
159
156
|
* where sub query using sub query sql
|
|
160
157
|
* @param {string} column
|
|
@@ -189,28 +186,28 @@ declare class Builder extends AbstractBuilder {
|
|
|
189
186
|
* @param {array} array
|
|
190
187
|
* @return {this}
|
|
191
188
|
*/
|
|
192
|
-
whereBetween(column: string, array:
|
|
189
|
+
whereBetween(column: string, array: any[]): this;
|
|
193
190
|
/**
|
|
194
191
|
* where between using [value1, value2]
|
|
195
192
|
* @param {string} column
|
|
196
193
|
* @param {array} array
|
|
197
194
|
* @return {this}
|
|
198
195
|
*/
|
|
199
|
-
orWhereBetween(column: string, array:
|
|
196
|
+
orWhereBetween(column: string, array: any[]): this;
|
|
200
197
|
/**
|
|
201
198
|
* where not between using [value1, value2]
|
|
202
199
|
* @param {string} column
|
|
203
200
|
* @param {array} array
|
|
204
201
|
* @return {this}
|
|
205
202
|
*/
|
|
206
|
-
whereNotBetween(column: string, array:
|
|
203
|
+
whereNotBetween(column: string, array: any[]): this;
|
|
207
204
|
/**
|
|
208
205
|
* where not between using [value1, value2]
|
|
209
206
|
* @param {string} column
|
|
210
207
|
* @param {array} array
|
|
211
208
|
* @return {this}
|
|
212
209
|
*/
|
|
213
|
-
orWhereNotBetween(column: string, array:
|
|
210
|
+
orWhereNotBetween(column: string, array: any[]): this;
|
|
214
211
|
/**
|
|
215
212
|
* where null using NULL
|
|
216
213
|
* @param {string} column
|
|
@@ -289,8 +286,8 @@ declare class Builder extends AbstractBuilder {
|
|
|
289
286
|
}[], as: string): this;
|
|
290
287
|
/**
|
|
291
288
|
*
|
|
292
|
-
* @param {string}
|
|
293
|
-
* @param {string}
|
|
289
|
+
* @param {string} localKey local key in current table
|
|
290
|
+
* @param {string} referenceKey reference key in next table
|
|
294
291
|
* @example
|
|
295
292
|
* await new DB('users')
|
|
296
293
|
* .select('users.id as userId','posts.id as postId','email')
|
|
@@ -301,78 +298,78 @@ declare class Builder extends AbstractBuilder {
|
|
|
301
298
|
* .get()
|
|
302
299
|
* @return {this}
|
|
303
300
|
*/
|
|
304
|
-
join(
|
|
301
|
+
join(localKey: string, referenceKey: string): this;
|
|
305
302
|
/**
|
|
306
303
|
*
|
|
307
|
-
* @param {string}
|
|
308
|
-
* @param {string}
|
|
304
|
+
* @param {string} localKey local key in current table
|
|
305
|
+
* @param {string} referenceKey reference key in next table
|
|
309
306
|
* @return {this}
|
|
310
307
|
*/
|
|
311
|
-
rightJoin(
|
|
308
|
+
rightJoin(localKey: string, referenceKey: string): this;
|
|
312
309
|
/**
|
|
313
310
|
*
|
|
314
|
-
* @param {string}
|
|
315
|
-
* @param {string}
|
|
311
|
+
* @param {string} localKey local key in current table
|
|
312
|
+
* @param {string} referenceKey reference key in next table
|
|
316
313
|
* @return {this}
|
|
317
314
|
*/
|
|
318
|
-
leftJoin(
|
|
315
|
+
leftJoin(localKey: string, referenceKey: string): this;
|
|
319
316
|
/**
|
|
320
317
|
*
|
|
321
|
-
* @param {string}
|
|
322
|
-
* @param {string}
|
|
318
|
+
* @param {string} localKey local key in current table
|
|
319
|
+
* @param {string} referenceKey reference key in next table
|
|
323
320
|
* @return {this}
|
|
324
321
|
*/
|
|
325
|
-
crossJoin(
|
|
322
|
+
crossJoin(localKey: string, referenceKey: string): this;
|
|
326
323
|
/**
|
|
327
324
|
* sort the result in ASC or DESC order.
|
|
328
325
|
* @param {string} column
|
|
329
326
|
* @param {string?} order [order=asc] asc, desc
|
|
330
327
|
* @return {this}
|
|
331
328
|
*/
|
|
332
|
-
orderBy(column: string, order?: string
|
|
329
|
+
orderBy(column: string, order?: string): this;
|
|
333
330
|
/**
|
|
334
331
|
* sort the result in ASC or DESC order. can using with raw query
|
|
335
332
|
* @param {string} column
|
|
336
333
|
* @param {string?} order [order=asc] asc, desc
|
|
337
334
|
* @return {this}
|
|
338
335
|
*/
|
|
339
|
-
orderByRaw(column: string, order?: string
|
|
336
|
+
orderByRaw(column: string, order?: string): this;
|
|
340
337
|
/**
|
|
341
338
|
* sort the result in using DESC for order by.
|
|
342
339
|
* @param {string?} columns [column=id]
|
|
343
340
|
* @return {this}
|
|
344
341
|
*/
|
|
345
|
-
latest(...columns:
|
|
342
|
+
latest(...columns: string[]): this;
|
|
346
343
|
/**
|
|
347
344
|
* sort the result in using DESC for order by. can using with raw query
|
|
348
345
|
* @param {string?} columns [column=id]
|
|
349
346
|
* @return {this}
|
|
350
347
|
*/
|
|
351
|
-
latestRaw(...columns:
|
|
348
|
+
latestRaw(...columns: string[]): this;
|
|
352
349
|
/**
|
|
353
350
|
* sort the result in using ASC for order by.
|
|
354
351
|
* @param {string?} columns [column=id]
|
|
355
352
|
* @return {this}
|
|
356
353
|
*/
|
|
357
|
-
oldest(...columns:
|
|
354
|
+
oldest(...columns: string[]): this;
|
|
358
355
|
/**
|
|
359
356
|
* sort the result in using ASC for order by. can using with raw query
|
|
360
357
|
* @param {string?} columns [column=id]
|
|
361
358
|
* @return {this}
|
|
362
359
|
*/
|
|
363
|
-
oldestRaw(...columns:
|
|
360
|
+
oldestRaw(...columns: string[]): this;
|
|
364
361
|
/**
|
|
365
362
|
*
|
|
366
363
|
* @param {string?} columns [column=id]
|
|
367
364
|
* @return {this}
|
|
368
365
|
*/
|
|
369
|
-
groupBy(...columns:
|
|
366
|
+
groupBy(...columns: string[]): this;
|
|
370
367
|
/**
|
|
371
368
|
*
|
|
372
369
|
* @param {string?} columns [column=id]
|
|
373
370
|
* @return {this}
|
|
374
371
|
*/
|
|
375
|
-
groupByRaw(...columns:
|
|
372
|
+
groupByRaw(...columns: string[]): this;
|
|
376
373
|
/**
|
|
377
374
|
*
|
|
378
375
|
* @param {string} condition
|
|
@@ -424,40 +421,36 @@ declare class Builder extends AbstractBuilder {
|
|
|
424
421
|
* @param {...string} columns
|
|
425
422
|
* @return {this} this
|
|
426
423
|
*/
|
|
427
|
-
hidden(...columns:
|
|
424
|
+
hidden(...columns: string[]): this;
|
|
428
425
|
/**
|
|
429
426
|
*
|
|
430
427
|
* update data in the database
|
|
431
428
|
* @param {object} data
|
|
429
|
+
* @param {array?} updateNotExists options for except update some records in your ${data} using name column(s)
|
|
432
430
|
* @return {this} this
|
|
433
431
|
*/
|
|
434
|
-
update(data:
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
432
|
+
update(data: Record<string, any>, updateNotExists?: string[]): this;
|
|
433
|
+
/**
|
|
434
|
+
*
|
|
435
|
+
* update record if data is empty in the database
|
|
436
|
+
* @param {object} data
|
|
437
|
+
* @return {this} this
|
|
438
|
+
*/
|
|
439
|
+
updateNotExists(data: Record<string, any>): this;
|
|
439
440
|
/**
|
|
440
441
|
*
|
|
441
442
|
* insert data into the database
|
|
442
443
|
* @param {object} data
|
|
443
444
|
* @return {this} this
|
|
444
445
|
*/
|
|
445
|
-
insert(data:
|
|
446
|
-
[key: string]: any;
|
|
447
|
-
} & {
|
|
448
|
-
length?: unknown;
|
|
449
|
-
}): this;
|
|
446
|
+
insert(data: Record<string, any>): this;
|
|
450
447
|
/**
|
|
451
448
|
*
|
|
452
449
|
* insert data into the database
|
|
453
450
|
* @param {object} data
|
|
454
451
|
* @return {this} this
|
|
455
452
|
*/
|
|
456
|
-
create(data:
|
|
457
|
-
[key: string]: any;
|
|
458
|
-
} & {
|
|
459
|
-
length?: unknown;
|
|
460
|
-
}): this;
|
|
453
|
+
create(data: Record<string, any>): this;
|
|
461
454
|
/**
|
|
462
455
|
*
|
|
463
456
|
* insert muliple data into the database
|
|
@@ -482,6 +475,11 @@ declare class Builder extends AbstractBuilder {
|
|
|
482
475
|
* @return {string} return sql query
|
|
483
476
|
*/
|
|
484
477
|
toSQL(): string;
|
|
478
|
+
/**
|
|
479
|
+
*
|
|
480
|
+
* @return {string}
|
|
481
|
+
*/
|
|
482
|
+
toRawSQL(): string;
|
|
485
483
|
/**
|
|
486
484
|
*
|
|
487
485
|
* @param {boolean} debug debug sql statements
|
|
@@ -511,11 +509,7 @@ declare class Builder extends AbstractBuilder {
|
|
|
511
509
|
* @param {object} data create not exists data
|
|
512
510
|
* @return {this} this this
|
|
513
511
|
*/
|
|
514
|
-
createNotExists(data:
|
|
515
|
-
[key: string]: any;
|
|
516
|
-
} & {
|
|
517
|
-
length?: unknown;
|
|
518
|
-
}): this;
|
|
512
|
+
createNotExists(data: Record<string, any>): this;
|
|
519
513
|
/**
|
|
520
514
|
*
|
|
521
515
|
* @param {object} data insert not exists data
|
|
@@ -612,6 +606,19 @@ declare class Builder extends AbstractBuilder {
|
|
|
612
606
|
* @return {promise<string>} string
|
|
613
607
|
*/
|
|
614
608
|
protected exceptColumns(): Promise<string[]>;
|
|
609
|
+
/**
|
|
610
|
+
* handler query update for except some columns
|
|
611
|
+
* @param {string} column
|
|
612
|
+
* @param {string} value
|
|
613
|
+
* @return {string} string
|
|
614
|
+
*/
|
|
615
|
+
protected _updateHandler(column: string, value?: string | number): string;
|
|
616
|
+
/**
|
|
617
|
+
*
|
|
618
|
+
* generate sql statements
|
|
619
|
+
* @return {string} string generated query string
|
|
620
|
+
*/
|
|
621
|
+
protected _buildQueryStatement(): string;
|
|
615
622
|
/**
|
|
616
623
|
* execute sql statements with raw sql query
|
|
617
624
|
* @param {string} sql sql execute return data
|
|
@@ -678,42 +685,34 @@ declare class Builder extends AbstractBuilder {
|
|
|
678
685
|
first(): Promise<Record<string, any> | null>;
|
|
679
686
|
/**
|
|
680
687
|
*
|
|
681
|
-
* execute data return object |
|
|
688
|
+
* execute data return object | null
|
|
682
689
|
* @return {promise<object | null>}
|
|
683
690
|
*/
|
|
684
|
-
findOne(): Promise<
|
|
685
|
-
[key: string]: any;
|
|
686
|
-
} | null>;
|
|
691
|
+
findOne(): Promise<Record<string, any> | null>;
|
|
687
692
|
/**
|
|
688
693
|
*
|
|
689
694
|
* execute data return object | throw Error
|
|
690
695
|
* @return {promise<object | Error>}
|
|
691
696
|
*/
|
|
692
|
-
firstOrError(message: string, options?:
|
|
693
|
-
[key: string]: any;
|
|
694
|
-
}): Promise<Record<string, any>>;
|
|
697
|
+
firstOrError(message: string, options?: Record<string, any>): Promise<Record<string, any>>;
|
|
695
698
|
/**
|
|
696
699
|
*
|
|
697
700
|
* execute data return object | null
|
|
698
701
|
* @return {promise<object | null>}
|
|
699
702
|
*/
|
|
700
|
-
findOneOrError(message: string, options?:
|
|
701
|
-
[key: string]: any;
|
|
702
|
-
}): Promise<{
|
|
703
|
-
[key: string]: any;
|
|
704
|
-
}>;
|
|
703
|
+
findOneOrError(message: string, options?: Record<string, any>): Promise<Record<string, any>>;
|
|
705
704
|
/**
|
|
706
705
|
*
|
|
707
706
|
* execute data return Array
|
|
708
|
-
* @return {promise<
|
|
707
|
+
* @return {promise<any[]>}
|
|
709
708
|
*/
|
|
710
|
-
get(): Promise<
|
|
709
|
+
get(): Promise<any[]>;
|
|
711
710
|
/**
|
|
712
711
|
*
|
|
713
712
|
* execute data return Array
|
|
714
|
-
* @return {promise<
|
|
713
|
+
* @return {promise<any[]>}
|
|
715
714
|
*/
|
|
716
|
-
findMany(): Promise<
|
|
715
|
+
findMany(): Promise<any[]>;
|
|
717
716
|
/**
|
|
718
717
|
*
|
|
719
718
|
* execute data return json of result
|
|
@@ -726,7 +725,13 @@ declare class Builder extends AbstractBuilder {
|
|
|
726
725
|
* @param {string=} column [column=id]
|
|
727
726
|
* @return {promise<Array>}
|
|
728
727
|
*/
|
|
729
|
-
toArray(column?: string): Promise<
|
|
728
|
+
toArray(column?: string): Promise<any[]>;
|
|
729
|
+
/**
|
|
730
|
+
*
|
|
731
|
+
* execute data return result is exists
|
|
732
|
+
* @return {promise<boolean>}
|
|
733
|
+
*/
|
|
734
|
+
exists(): Promise<boolean>;
|
|
730
735
|
/**
|
|
731
736
|
*
|
|
732
737
|
* execute data return number of results
|
|
@@ -734,12 +739,6 @@ declare class Builder extends AbstractBuilder {
|
|
|
734
739
|
* @return {promise<number>}
|
|
735
740
|
*/
|
|
736
741
|
count(column?: string): Promise<number>;
|
|
737
|
-
/**
|
|
738
|
-
*
|
|
739
|
-
* execute data return result is exists
|
|
740
|
-
* @return {promise<boolean>}
|
|
741
|
-
*/
|
|
742
|
-
exists(): Promise<boolean>;
|
|
743
742
|
/**
|
|
744
743
|
*
|
|
745
744
|
* execute data return average of results
|
|
@@ -786,35 +785,33 @@ declare class Builder extends AbstractBuilder {
|
|
|
786
785
|
* @param {string} column
|
|
787
786
|
* @return {promise<Array>}
|
|
788
787
|
*/
|
|
789
|
-
getGroupBy(column: string): Promise<
|
|
788
|
+
getGroupBy(column: string): Promise<any[]>;
|
|
790
789
|
/**
|
|
791
790
|
*
|
|
792
791
|
* execute data return grouping results by index
|
|
793
792
|
* @param {string} column
|
|
794
793
|
* @return {promise<Array>}
|
|
795
794
|
*/
|
|
796
|
-
findManyGroupBy(column: string): Promise<
|
|
795
|
+
findManyGroupBy(column: string): Promise<any[]>;
|
|
797
796
|
/**
|
|
798
797
|
* execute data when save *action [insert , update]
|
|
799
798
|
* @return {Promise<any>} promise
|
|
800
799
|
*/
|
|
801
|
-
save(): Promise<
|
|
802
|
-
[key: string]: any;
|
|
803
|
-
} | Array<any> | null | undefined>;
|
|
800
|
+
save(): Promise<Record<string, any> | any[] | null | undefined>;
|
|
804
801
|
/**
|
|
805
802
|
*
|
|
806
803
|
* show columns in table
|
|
807
804
|
* @param {string=} table table name
|
|
808
805
|
* @return {Promise<Array>}
|
|
809
806
|
*/
|
|
810
|
-
showColumns(table?: string): Promise<
|
|
807
|
+
showColumns(table?: string): Promise<string[]>;
|
|
811
808
|
/**
|
|
812
809
|
*
|
|
813
810
|
* show schemas in table
|
|
814
811
|
* @param {string=} table [table= current table name]
|
|
815
812
|
* @return {Promise<Array>}
|
|
816
813
|
*/
|
|
817
|
-
showSchemas(table?: string): Promise<
|
|
814
|
+
showSchemas(table?: string): Promise<string[]>;
|
|
818
815
|
/**
|
|
819
816
|
*
|
|
820
817
|
* get schema from table
|
|
@@ -827,7 +824,7 @@ declare class Builder extends AbstractBuilder {
|
|
|
827
824
|
* @param {string=} table table name
|
|
828
825
|
* @return {Promise<Array>}
|
|
829
826
|
*/
|
|
830
|
-
showValues(table?: string): Promise<
|
|
827
|
+
showValues(table?: string): Promise<string[]>;
|
|
831
828
|
/**
|
|
832
829
|
*
|
|
833
830
|
* backup this database intro new database same server or to another server
|
|
@@ -929,11 +926,11 @@ declare class Builder extends AbstractBuilder {
|
|
|
929
926
|
* @param {string?} tableAndForeignKey
|
|
930
927
|
* @return {this}
|
|
931
928
|
*/
|
|
932
|
-
protected whereReference(tableAndLocalKey: string, tableAndForeignKey?:
|
|
929
|
+
protected whereReference(tableAndLocalKey: string, tableAndForeignKey?: string): this;
|
|
933
930
|
private _queryWhereIsExists;
|
|
934
931
|
private _bindTableAndColumnInQueryWhere;
|
|
935
932
|
private _insertNotExists;
|
|
936
|
-
protected queryStatement(sql: string): Promise<
|
|
933
|
+
protected queryStatement(sql: string): Promise<any[]>;
|
|
937
934
|
protected actionStatement({ sql, returnId }: {
|
|
938
935
|
sql: string;
|
|
939
936
|
returnId?: boolean;
|
|
@@ -950,7 +947,6 @@ declare class Builder extends AbstractBuilder {
|
|
|
950
947
|
private _queryInsertMultiple;
|
|
951
948
|
private _valueAndOperator;
|
|
952
949
|
private _valueTrueFalse;
|
|
953
|
-
private _buildQuery;
|
|
954
950
|
private _initialConnection;
|
|
955
951
|
}
|
|
956
952
|
export { Builder };
|