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
|
@@ -1,706 +1,825 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Pagination, Backup, ConnectionOptions, BackupToFile, Connection, ConnectionTransaction } from './Interface';
|
|
3
|
-
declare class
|
|
4
|
-
constructor();
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @param {string} column
|
|
8
|
-
* @return {this}
|
|
9
|
-
*/
|
|
10
|
-
pluck(column: string): this;
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @param {...string} columns
|
|
14
|
-
* @return {this} this
|
|
15
|
-
*/
|
|
16
|
-
except(...columns: Array<string>): this;
|
|
17
|
-
/**
|
|
18
|
-
* data alaways will return void
|
|
19
|
-
* @return {this} this
|
|
20
|
-
*/
|
|
21
|
-
void(): this;
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
* @param {...string} columns show only colums selected
|
|
25
|
-
* @return {this} this
|
|
26
|
-
*/
|
|
27
|
-
only(...columns: Array<string>): this;
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @param {string=} column [column=id]
|
|
31
|
-
* @return {this} this
|
|
32
|
-
*/
|
|
33
|
-
distinct(column?: string): this;
|
|
34
|
-
/**
|
|
35
|
-
* select data form table
|
|
36
|
-
* @param {Array<string>} ...columns
|
|
37
|
-
* @return {this} this
|
|
38
|
-
*/
|
|
39
|
-
select(...columns: Array<string>): this;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
*
|
|
43
|
-
* @
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
* @
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*
|
|
55
|
-
* @param {string
|
|
56
|
-
* @param {
|
|
57
|
-
* @
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
*
|
|
63
|
-
* @param {
|
|
64
|
-
* @
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
*
|
|
71
|
-
* @
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*
|
|
79
|
-
* @param {string
|
|
80
|
-
* @
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
*
|
|
86
|
-
* @
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
*
|
|
92
|
-
* @param {string}
|
|
93
|
-
* @return {this}
|
|
94
|
-
*/
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* @param {string
|
|
100
|
-
* @return {this}
|
|
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
|
-
* @param {
|
|
126
|
-
* @
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
*
|
|
132
|
-
* @param {
|
|
133
|
-
* @
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
*
|
|
139
|
-
* @param {
|
|
140
|
-
* @
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
*
|
|
146
|
-
* @param {
|
|
147
|
-
* @
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
*
|
|
153
|
-
* @param {string}
|
|
154
|
-
* @
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
*
|
|
160
|
-
* @param {string}
|
|
161
|
-
* @
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
*
|
|
167
|
-
* @param {string}
|
|
168
|
-
* @
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
*
|
|
174
|
-
* @param {string}
|
|
175
|
-
* @
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
*
|
|
181
|
-
* @param {
|
|
182
|
-
* @return {this}
|
|
183
|
-
*/
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* where
|
|
187
|
-
* @param {string} column
|
|
188
|
-
* @return {this}
|
|
189
|
-
*/
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* where
|
|
193
|
-
* @param {string} column
|
|
194
|
-
* @
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
*
|
|
201
|
-
* @param {
|
|
202
|
-
* @return {this}
|
|
203
|
-
*/
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
*
|
|
207
|
-
* @param {
|
|
208
|
-
* @param {string}
|
|
209
|
-
* @
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
*
|
|
215
|
-
* @
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
*
|
|
221
|
-
* @param {
|
|
222
|
-
* @
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
*
|
|
228
|
-
* @param {string}
|
|
229
|
-
* @
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
*
|
|
235
|
-
* @param {string}
|
|
236
|
-
* @
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
*
|
|
242
|
-
* @param {string}
|
|
243
|
-
* @
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
*
|
|
249
|
-
* @param {string
|
|
250
|
-
* @
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
*
|
|
256
|
-
* @
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
*
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
*
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
*
|
|
306
|
-
* @param {
|
|
307
|
-
* @return {this}
|
|
308
|
-
*/
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* @
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
*
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
*
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
*
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
*
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
*
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
*
|
|
360
|
-
* @
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
*
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
* @param {object} data
|
|
382
|
-
* @return {this} this
|
|
383
|
-
*/
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
*
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
* @param {
|
|
400
|
-
* @return {this} this
|
|
401
|
-
*/
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
*
|
|
405
|
-
* @
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
*
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
*
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
*
|
|
422
|
-
* @
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
*
|
|
439
|
-
* @
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
* @
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
* @param {
|
|
459
|
-
* @
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
*
|
|
468
|
-
*
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
*
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
* @return {
|
|
518
|
-
*/
|
|
519
|
-
|
|
520
|
-
/**
|
|
521
|
-
*
|
|
522
|
-
*
|
|
523
|
-
* @return {
|
|
524
|
-
*/
|
|
525
|
-
|
|
526
|
-
/**
|
|
527
|
-
*
|
|
528
|
-
*
|
|
529
|
-
* @return {
|
|
530
|
-
*/
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
*
|
|
534
|
-
*
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
*
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
*
|
|
548
|
-
*
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
*
|
|
554
|
-
*
|
|
555
|
-
* @param {
|
|
556
|
-
* @return {promise<
|
|
557
|
-
*/
|
|
558
|
-
|
|
559
|
-
/**
|
|
560
|
-
*
|
|
561
|
-
*
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
*
|
|
568
|
-
*
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
* @param {
|
|
577
|
-
* @return {promise<
|
|
578
|
-
*/
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
*
|
|
588
|
-
*
|
|
589
|
-
* @return {promise<
|
|
590
|
-
*/
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
*
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
*
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
*
|
|
623
|
-
*
|
|
624
|
-
* @return {
|
|
625
|
-
*/
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
*
|
|
639
|
-
*
|
|
640
|
-
* @
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
*
|
|
645
|
-
|
|
646
|
-
* @return {
|
|
647
|
-
*/
|
|
648
|
-
|
|
649
|
-
/**
|
|
650
|
-
*
|
|
651
|
-
*
|
|
652
|
-
* @param {
|
|
653
|
-
* @
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
* @param {string}
|
|
660
|
-
* @
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
*
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
*
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
1
|
+
import { AbstractBuilder } from './AbstractBuilder';
|
|
2
|
+
import { Pagination, Backup, ConnectionOptions, BackupToFile, Connection, ConnectionTransaction } from './Interface';
|
|
3
|
+
declare class Builder extends AbstractBuilder {
|
|
4
|
+
constructor();
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param {string} column
|
|
8
|
+
* @return {this}
|
|
9
|
+
*/
|
|
10
|
+
pluck(column: string): this;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param {...string} columns
|
|
14
|
+
* @return {this} this
|
|
15
|
+
*/
|
|
16
|
+
except(...columns: Array<string>): this;
|
|
17
|
+
/**
|
|
18
|
+
* data alaways will return void
|
|
19
|
+
* @return {this} this
|
|
20
|
+
*/
|
|
21
|
+
void(): this;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param {...string} columns show only colums selected
|
|
25
|
+
* @return {this} this
|
|
26
|
+
*/
|
|
27
|
+
only(...columns: Array<string>): this;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param {string=} column [column=id]
|
|
31
|
+
* @return {this} this
|
|
32
|
+
*/
|
|
33
|
+
distinct(column?: string): this;
|
|
34
|
+
/**
|
|
35
|
+
* select data form table
|
|
36
|
+
* @param {Array<string>} ...columns
|
|
37
|
+
* @return {this} this
|
|
38
|
+
*/
|
|
39
|
+
select(...columns: Array<string>): this;
|
|
40
|
+
selectRaw(...columns: Array<string>): this;
|
|
41
|
+
/**
|
|
42
|
+
* chunks data from array
|
|
43
|
+
* @param {number} chunk
|
|
44
|
+
* @return {this} this
|
|
45
|
+
*/
|
|
46
|
+
chunk(chunk: number): this;
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @param {string | number | undefined | null | Boolean} condition when condition true will return query callback
|
|
50
|
+
* @return {this} this
|
|
51
|
+
*/
|
|
52
|
+
when(condition: string | number | undefined | null | Boolean, callback: Function): this;
|
|
53
|
+
/**
|
|
54
|
+
* if has 2 arguments default operator '='
|
|
55
|
+
* @param {string} column if arguments is object
|
|
56
|
+
* @param {string?} operator ['=', '<', '>' ,'!=', '!<', '!>' ,'LIKE']
|
|
57
|
+
* @param {any?} value
|
|
58
|
+
* @return {this}
|
|
59
|
+
*/
|
|
60
|
+
where(column: string | any, operator?: any, value?: any): this;
|
|
61
|
+
/**
|
|
62
|
+
* where using object operator only '='
|
|
63
|
+
* @param {Object} columns
|
|
64
|
+
* @return {this}
|
|
65
|
+
*/
|
|
66
|
+
whereObject(columns: {
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
}): this;
|
|
69
|
+
/**
|
|
70
|
+
* if has 2 arguments default operator '='
|
|
71
|
+
* @param {string} column
|
|
72
|
+
* @param {string?} operator ['=', '<', '>' ,'!=', '!<', '!>' ,'LIKE']
|
|
73
|
+
* @param {any?} value
|
|
74
|
+
* @return {this}
|
|
75
|
+
*/
|
|
76
|
+
orWhere(column: string, operator?: any, value?: any): this;
|
|
77
|
+
/**
|
|
78
|
+
*
|
|
79
|
+
* @param {string} sql where column with raw sql
|
|
80
|
+
* @return {this} this
|
|
81
|
+
*/
|
|
82
|
+
whereRaw(sql: string): this;
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
* @param {string} query where column with raw sql
|
|
86
|
+
* @return {this} this
|
|
87
|
+
*/
|
|
88
|
+
orWhereRaw(sql: string): this;
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
* @param {string} tableAndLocalKey
|
|
92
|
+
* @param {string?} tableAndForeignKey
|
|
93
|
+
* @return {this}
|
|
94
|
+
*/
|
|
95
|
+
protected whereReference(tableAndLocalKey: string, tableAndForeignKey?: any): this;
|
|
96
|
+
/**
|
|
97
|
+
*
|
|
98
|
+
* where exists
|
|
99
|
+
* @param {string} sql
|
|
100
|
+
* @return {this}
|
|
101
|
+
*/
|
|
102
|
+
whereExists(sql: string): this;
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* @param {number} id
|
|
106
|
+
* @return {this} this
|
|
107
|
+
*/
|
|
108
|
+
whereId(id: number, column?: string): this;
|
|
109
|
+
/**
|
|
110
|
+
*
|
|
111
|
+
* @param {string} email where using email
|
|
112
|
+
* @return {this}
|
|
113
|
+
*/
|
|
114
|
+
whereEmail(email: string): this;
|
|
115
|
+
/**
|
|
116
|
+
*
|
|
117
|
+
* @param {number} userId
|
|
118
|
+
* @param {string?} column custom it *if column is not user_id
|
|
119
|
+
* @return {this}
|
|
120
|
+
*/
|
|
121
|
+
whereUser(userId: number, column?: string): this;
|
|
122
|
+
/**
|
|
123
|
+
* using array value where in value in array
|
|
124
|
+
* @param {string} column
|
|
125
|
+
* @param {array} array
|
|
126
|
+
* @return {this}
|
|
127
|
+
*/
|
|
128
|
+
whereIn(column: string, array: Array<any>): this;
|
|
129
|
+
/**
|
|
130
|
+
* or where in data using array values
|
|
131
|
+
* @param {string} column
|
|
132
|
+
* @param {array} array
|
|
133
|
+
* @return {this}
|
|
134
|
+
*/
|
|
135
|
+
orWhereIn(column: string, array: Array<any>): this;
|
|
136
|
+
/**
|
|
137
|
+
* where not in data using array values
|
|
138
|
+
* @param {string} column
|
|
139
|
+
* @param {array} array
|
|
140
|
+
* @return {this}
|
|
141
|
+
*/
|
|
142
|
+
whereNotIn(column: string, array: Array<any>): this;
|
|
143
|
+
/**
|
|
144
|
+
* where not in data using array values
|
|
145
|
+
* @param {string} column
|
|
146
|
+
* @param {array} array
|
|
147
|
+
* @return {this}
|
|
148
|
+
*/
|
|
149
|
+
orWhereNotIn(column: string, array: Array<any>): this;
|
|
150
|
+
/**
|
|
151
|
+
* where sub query using sub query sql
|
|
152
|
+
* @param {string} column
|
|
153
|
+
* @param {string} subQuery
|
|
154
|
+
* @return {this}
|
|
155
|
+
*/
|
|
156
|
+
whereSubQuery(column: string, subQuery: string): this;
|
|
157
|
+
/**
|
|
158
|
+
* where not sub query using sub query sql
|
|
159
|
+
* @param {string} column
|
|
160
|
+
* @param {string} subQuery
|
|
161
|
+
* @return {this}
|
|
162
|
+
*/
|
|
163
|
+
whereNotSubQuery(column: string, subQuery: string): this;
|
|
164
|
+
/**
|
|
165
|
+
* or where not sub query using query sql
|
|
166
|
+
* @param {string} column
|
|
167
|
+
* @param {string} subQuery
|
|
168
|
+
* @return {this}
|
|
169
|
+
*/
|
|
170
|
+
orWhereSubQuery(column: string, subQuery: string): this;
|
|
171
|
+
/**
|
|
172
|
+
* or where not sub query using query sql
|
|
173
|
+
* @param {string} column
|
|
174
|
+
* @param {string} subQuery
|
|
175
|
+
* @return {this}
|
|
176
|
+
*/
|
|
177
|
+
orWhereNotSubQuery(column: string, subQuery: string): this;
|
|
178
|
+
/**
|
|
179
|
+
* where between using [value1, value2]
|
|
180
|
+
* @param {string} column
|
|
181
|
+
* @param {array} array
|
|
182
|
+
* @return {this}
|
|
183
|
+
*/
|
|
184
|
+
whereBetween(column: string, array: Array<any>): this;
|
|
185
|
+
/**
|
|
186
|
+
* where null using NULL
|
|
187
|
+
* @param {string} column
|
|
188
|
+
* @return {this}
|
|
189
|
+
*/
|
|
190
|
+
whereNull(column: string): this;
|
|
191
|
+
/**
|
|
192
|
+
* where not null using NULL
|
|
193
|
+
* @param {string} column
|
|
194
|
+
* @return {this}
|
|
195
|
+
*/
|
|
196
|
+
whereNotNull(column: string): this;
|
|
197
|
+
/**
|
|
198
|
+
* where sensitive (uppercase, lowercase)
|
|
199
|
+
* @param {string} column
|
|
200
|
+
* @param {string?} operator = < > != !< !>
|
|
201
|
+
* @param {any?} value
|
|
202
|
+
* @return {this}
|
|
203
|
+
*/
|
|
204
|
+
whereSensitive(column: string, operator?: any, value?: any): this;
|
|
205
|
+
/**
|
|
206
|
+
* where Strict (uppercase, lowercase)
|
|
207
|
+
* @param {string} column
|
|
208
|
+
* @param {string?} operator = < > != !< !>
|
|
209
|
+
* @param {any?} value
|
|
210
|
+
* @return {this}
|
|
211
|
+
*/
|
|
212
|
+
whereStrict(column: string, operator?: any, value?: any): this;
|
|
213
|
+
/**
|
|
214
|
+
* where group query
|
|
215
|
+
* @param {function} callback callback query
|
|
216
|
+
* @return {this}
|
|
217
|
+
*/
|
|
218
|
+
whereQuery(callback: Function): this;
|
|
219
|
+
/**
|
|
220
|
+
* select by cases
|
|
221
|
+
* @param {array} cases array object [{ when : 'id < 7' , then : 'id is than under 7'}]
|
|
222
|
+
* @param {string} as
|
|
223
|
+
* @return {this}
|
|
224
|
+
*/
|
|
225
|
+
case(cases: string | any[], as: string): this;
|
|
226
|
+
/**
|
|
227
|
+
*
|
|
228
|
+
* @param {string} pk talbe.pk
|
|
229
|
+
* @param {string} fk talbe.fk
|
|
230
|
+
* @return {this}
|
|
231
|
+
*/
|
|
232
|
+
join(pk: string, fk: string): this;
|
|
233
|
+
/**
|
|
234
|
+
*
|
|
235
|
+
* @param {string} pk talbe.pk
|
|
236
|
+
* @param {string} fk talbe.fk
|
|
237
|
+
* @return {this}
|
|
238
|
+
*/
|
|
239
|
+
rightJoin(pk: string, fk: string): this;
|
|
240
|
+
/**
|
|
241
|
+
*
|
|
242
|
+
* @param {string} pk talbe.pk
|
|
243
|
+
* @param {string} fk talbe.fk
|
|
244
|
+
* @return {this}
|
|
245
|
+
*/
|
|
246
|
+
leftJoin(pk: string, fk: string): this;
|
|
247
|
+
/**
|
|
248
|
+
*
|
|
249
|
+
* @param {string} pk talbe.pk
|
|
250
|
+
* @param {string} fk talbe.fk
|
|
251
|
+
* @return {this}
|
|
252
|
+
*/
|
|
253
|
+
crossJoin(pk: string, fk: string): this;
|
|
254
|
+
/**
|
|
255
|
+
* sort the result in ASC or DESC order.
|
|
256
|
+
* @param {string} column
|
|
257
|
+
* @param {string?} order [order=asc] asc, desc
|
|
258
|
+
* @return {this}
|
|
259
|
+
*/
|
|
260
|
+
orderBy(column: string, order?: string | undefined): this;
|
|
261
|
+
/**
|
|
262
|
+
* sort the result in ASC or DESC order. can using with raw query
|
|
263
|
+
* @param {string} column
|
|
264
|
+
* @param {string?} order [order=asc] asc, desc
|
|
265
|
+
* @return {this}
|
|
266
|
+
*/
|
|
267
|
+
orderByRaw(column: string, order?: string | undefined): this;
|
|
268
|
+
/**
|
|
269
|
+
* sort the result in using DESC for order by.
|
|
270
|
+
* @param {string?} columns [column=id]
|
|
271
|
+
* @return {this}
|
|
272
|
+
*/
|
|
273
|
+
latest(...columns: Array<string>): this;
|
|
274
|
+
/**
|
|
275
|
+
* sort the result in using DESC for order by. can using with raw query
|
|
276
|
+
* @param {string?} columns [column=id]
|
|
277
|
+
* @return {this}
|
|
278
|
+
*/
|
|
279
|
+
latestRaw(...columns: Array<string>): this;
|
|
280
|
+
/**
|
|
281
|
+
* sort the result in using ASC for order by.
|
|
282
|
+
* @param {string?} columns [column=id]
|
|
283
|
+
* @return {this}
|
|
284
|
+
*/
|
|
285
|
+
oldest(...columns: Array<string>): this;
|
|
286
|
+
/**
|
|
287
|
+
* sort the result in using ASC for order by. can using with raw query
|
|
288
|
+
* @param {string?} columns [column=id]
|
|
289
|
+
* @return {this}
|
|
290
|
+
*/
|
|
291
|
+
oldestRaw(...columns: Array<string>): this;
|
|
292
|
+
/**
|
|
293
|
+
*
|
|
294
|
+
* @param {string?} columns [column=id]
|
|
295
|
+
* @return {this}
|
|
296
|
+
*/
|
|
297
|
+
groupBy(...columns: Array<string>): this;
|
|
298
|
+
/**
|
|
299
|
+
*
|
|
300
|
+
* @param {string?} columns [column=id]
|
|
301
|
+
* @return {this}
|
|
302
|
+
*/
|
|
303
|
+
groupByRaw(...columns: Array<string>): this;
|
|
304
|
+
/**
|
|
305
|
+
*
|
|
306
|
+
* @param {string} condition
|
|
307
|
+
* @return {this}
|
|
308
|
+
*/
|
|
309
|
+
having(condition: string): this;
|
|
310
|
+
/**
|
|
311
|
+
*
|
|
312
|
+
* @param {string} condition
|
|
313
|
+
* @return {this}
|
|
314
|
+
*/
|
|
315
|
+
havingRaw(condition: string): this;
|
|
316
|
+
/**
|
|
317
|
+
* sort the result in random order.
|
|
318
|
+
* @return {this}
|
|
319
|
+
*/
|
|
320
|
+
random(): this;
|
|
321
|
+
/**
|
|
322
|
+
* sort the result in random order.
|
|
323
|
+
* @return {this}
|
|
324
|
+
*/
|
|
325
|
+
inRandom(): this;
|
|
326
|
+
/**
|
|
327
|
+
* limit data
|
|
328
|
+
* @param {number=} number [number=1]
|
|
329
|
+
* @return {this}
|
|
330
|
+
*/
|
|
331
|
+
limit(number?: number): this;
|
|
332
|
+
/**
|
|
333
|
+
* limit data
|
|
334
|
+
* @param {number=} number [number=1]
|
|
335
|
+
* @return {this}
|
|
336
|
+
*/
|
|
337
|
+
take(number?: number): this;
|
|
338
|
+
/**
|
|
339
|
+
*
|
|
340
|
+
* @param {number=} number [number=1]
|
|
341
|
+
* @return {this}
|
|
342
|
+
*/
|
|
343
|
+
offset(number?: number): this;
|
|
344
|
+
/**
|
|
345
|
+
*
|
|
346
|
+
* @param {number=} number [number=1]
|
|
347
|
+
* @return {this}
|
|
348
|
+
*/
|
|
349
|
+
skip(number?: number): this;
|
|
350
|
+
/**
|
|
351
|
+
*
|
|
352
|
+
* @param {...string} columns
|
|
353
|
+
* @return {this} this
|
|
354
|
+
*/
|
|
355
|
+
hidden(...columns: Array<string>): this;
|
|
356
|
+
/**
|
|
357
|
+
*
|
|
358
|
+
* update data in the database
|
|
359
|
+
* @param {object} data
|
|
360
|
+
* @return {this} this
|
|
361
|
+
*/
|
|
362
|
+
update(data: {
|
|
363
|
+
[key: string]: any;
|
|
364
|
+
} & {
|
|
365
|
+
length?: unknown;
|
|
366
|
+
}): this;
|
|
367
|
+
/**
|
|
368
|
+
*
|
|
369
|
+
* insert data into the database
|
|
370
|
+
* @param {object} data
|
|
371
|
+
* @return {this} this
|
|
372
|
+
*/
|
|
373
|
+
insert(data: {
|
|
374
|
+
[key: string]: any;
|
|
375
|
+
} & {
|
|
376
|
+
length?: unknown;
|
|
377
|
+
}): this;
|
|
378
|
+
/**
|
|
379
|
+
*
|
|
380
|
+
* insert data into the database
|
|
381
|
+
* @param {object} data
|
|
382
|
+
* @return {this} this
|
|
383
|
+
*/
|
|
384
|
+
create(data: {
|
|
385
|
+
[key: string]: any;
|
|
386
|
+
} & {
|
|
387
|
+
length?: unknown;
|
|
388
|
+
}): this;
|
|
389
|
+
/**
|
|
390
|
+
*
|
|
391
|
+
* insert muliple data into the database
|
|
392
|
+
* @param {array} data create multiple data
|
|
393
|
+
* @return {this} this this
|
|
394
|
+
*/
|
|
395
|
+
createMultiple(data: Array<any>): this;
|
|
396
|
+
/**
|
|
397
|
+
*
|
|
398
|
+
* insert muliple data into the database
|
|
399
|
+
* @param {array} data create multiple data
|
|
400
|
+
* @return {this} this this
|
|
401
|
+
*/
|
|
402
|
+
insertMultiple(data: Array<any>): this;
|
|
403
|
+
/**
|
|
404
|
+
*
|
|
405
|
+
* @return {string} return sql query
|
|
406
|
+
*/
|
|
407
|
+
toString(): string;
|
|
408
|
+
/**
|
|
409
|
+
*
|
|
410
|
+
* @return {string} return sql query
|
|
411
|
+
*/
|
|
412
|
+
toSQL(): string;
|
|
413
|
+
/**
|
|
414
|
+
*
|
|
415
|
+
* @param {boolean} debug debug sql statements
|
|
416
|
+
* @return {this} this this
|
|
417
|
+
*/
|
|
418
|
+
debug(debug?: boolean): this;
|
|
419
|
+
/**
|
|
420
|
+
*
|
|
421
|
+
* @param {boolean} debug debug sql statements
|
|
422
|
+
* @return {this} this this
|
|
423
|
+
*/
|
|
424
|
+
dd(debug?: boolean): this;
|
|
425
|
+
/**
|
|
426
|
+
* hook function when execute returned result to callback function
|
|
427
|
+
* @param {Function} func function for callback result
|
|
428
|
+
* @return {this}
|
|
429
|
+
*/
|
|
430
|
+
hook(func: Function): this;
|
|
431
|
+
/**
|
|
432
|
+
* hook function when execute returned result to callback function
|
|
433
|
+
* @param {Function} func function for callback result
|
|
434
|
+
* @return {this}
|
|
435
|
+
*/
|
|
436
|
+
before(func: Function): this;
|
|
437
|
+
/**
|
|
438
|
+
*
|
|
439
|
+
* @param {object} data create not exists data
|
|
440
|
+
* @return {this} this this
|
|
441
|
+
*/
|
|
442
|
+
createNotExists(data: {
|
|
443
|
+
[key: string]: any;
|
|
444
|
+
} & {
|
|
445
|
+
length?: unknown;
|
|
446
|
+
}): this;
|
|
447
|
+
/**
|
|
448
|
+
*
|
|
449
|
+
* @param {object} data insert not exists data
|
|
450
|
+
* @return {this} this this
|
|
451
|
+
*/
|
|
452
|
+
insertNotExists(data: Record<string, any> & {
|
|
453
|
+
length?: never;
|
|
454
|
+
}): this;
|
|
455
|
+
/**
|
|
456
|
+
*
|
|
457
|
+
* check data if exists if exists then return result. if not exists insert data
|
|
458
|
+
* @param {object} data insert data
|
|
459
|
+
* @return {this} this this
|
|
460
|
+
*/
|
|
461
|
+
createOrSelect(data: Record<string, any> & {
|
|
462
|
+
length?: never;
|
|
463
|
+
}): this;
|
|
464
|
+
/**
|
|
465
|
+
*
|
|
466
|
+
* check data if exists if exists then update. if not exists insert
|
|
467
|
+
* @param {object} data insert or update data
|
|
468
|
+
* @return {this} this this
|
|
469
|
+
*/
|
|
470
|
+
insertOrSelect(data: Record<string, any> & {
|
|
471
|
+
length?: never;
|
|
472
|
+
}): this;
|
|
473
|
+
/**
|
|
474
|
+
*
|
|
475
|
+
* check data if exists if exists then update. if not exists insert
|
|
476
|
+
* @param {object} data insert or update data
|
|
477
|
+
* @return {this} this this
|
|
478
|
+
*/
|
|
479
|
+
updateOrCreate(data: Record<string, any> & {
|
|
480
|
+
length?: never;
|
|
481
|
+
}): this;
|
|
482
|
+
/**
|
|
483
|
+
*
|
|
484
|
+
* check data if exists if exists then update. if not exists insert
|
|
485
|
+
* @param {object} data insert or update data
|
|
486
|
+
* @return {this} this this
|
|
487
|
+
*/
|
|
488
|
+
updateOrInsert(data: Record<string, any> & {
|
|
489
|
+
length?: never;
|
|
490
|
+
}): this;
|
|
491
|
+
/**
|
|
492
|
+
*
|
|
493
|
+
* check data if exists if exists then update. if not exists insert
|
|
494
|
+
* @param {object} data insert or update data
|
|
495
|
+
* @return {this} this this
|
|
496
|
+
*/
|
|
497
|
+
insertOrUpdate(data: Record<string, any> & {
|
|
498
|
+
length?: never;
|
|
499
|
+
}): this;
|
|
500
|
+
/**
|
|
501
|
+
*
|
|
502
|
+
* check data if exists if exists then update. if not exists insert
|
|
503
|
+
* @param {object} data create or update data
|
|
504
|
+
* @return {this} this this
|
|
505
|
+
*/
|
|
506
|
+
createOrUpdate(data: Record<string, any> & {
|
|
507
|
+
length?: never;
|
|
508
|
+
}): this;
|
|
509
|
+
/**
|
|
510
|
+
*
|
|
511
|
+
* @param {Object} options options for connection database with credentials
|
|
512
|
+
* @param {string} option.host
|
|
513
|
+
* @param {number} option.port
|
|
514
|
+
* @param {string} option.database
|
|
515
|
+
* @param {string} option.user
|
|
516
|
+
* @param {string} option.password
|
|
517
|
+
* @return {this} this
|
|
518
|
+
*/
|
|
519
|
+
connection(options: ConnectionOptions): this;
|
|
520
|
+
/**
|
|
521
|
+
*
|
|
522
|
+
* @param {Function} pool pool connection database
|
|
523
|
+
* @return {this} this
|
|
524
|
+
*/
|
|
525
|
+
pool(pool: Connection): this;
|
|
526
|
+
/**
|
|
527
|
+
* make sure this connection has same transaction in pool connection
|
|
528
|
+
* @param {object} connection pool database
|
|
529
|
+
* @return {this} this
|
|
530
|
+
*/
|
|
531
|
+
bind(connection: Connection | ConnectionTransaction): this;
|
|
532
|
+
/**
|
|
533
|
+
* exceptColumns for method except
|
|
534
|
+
* @return {promise<string>} string
|
|
535
|
+
*/
|
|
536
|
+
protected exceptColumns(): Promise<string>;
|
|
537
|
+
/**
|
|
538
|
+
* execute sql statements with raw sql query
|
|
539
|
+
* @param {string} sql sql execute return data
|
|
540
|
+
* @return {promise<any>}
|
|
541
|
+
*/
|
|
542
|
+
rawQuery(sql: string): Promise<any>;
|
|
543
|
+
/**
|
|
544
|
+
*
|
|
545
|
+
* plus value then update
|
|
546
|
+
* @param {string} column
|
|
547
|
+
* @param {number} value
|
|
548
|
+
* @return {promise<any>}
|
|
549
|
+
*/
|
|
550
|
+
increment(column?: string, value?: number): Promise<any>;
|
|
551
|
+
/**
|
|
552
|
+
*
|
|
553
|
+
* minus value then update
|
|
554
|
+
* @param {string} column
|
|
555
|
+
* @param {number} value
|
|
556
|
+
* @return {promise<any>}
|
|
557
|
+
*/
|
|
558
|
+
decrement(column?: string, value?: number): Promise<any>;
|
|
559
|
+
/**
|
|
560
|
+
* execute data without condition
|
|
561
|
+
* @return {promise<any>}
|
|
562
|
+
*/
|
|
563
|
+
all(): Promise<any>;
|
|
564
|
+
/**
|
|
565
|
+
*
|
|
566
|
+
* execute data with where by primary key default = id
|
|
567
|
+
* @param {number} id
|
|
568
|
+
* @return {promise<any>}
|
|
569
|
+
*/
|
|
570
|
+
find(id: number): Promise<Record<string, any> | null>;
|
|
571
|
+
/**
|
|
572
|
+
*
|
|
573
|
+
* execute data page & limit
|
|
574
|
+
* @param {?object} paginationOptions
|
|
575
|
+
* @param {number} paginationOptions.limit default 15
|
|
576
|
+
* @param {number} paginationOptions.page default 1
|
|
577
|
+
* @return {promise<Pagination>}
|
|
578
|
+
*/
|
|
579
|
+
pagination(paginationOptions?: {
|
|
580
|
+
limit?: number;
|
|
581
|
+
page?: number;
|
|
582
|
+
}): Promise<Pagination>;
|
|
583
|
+
/**
|
|
584
|
+
*
|
|
585
|
+
* execute data useing page & limit
|
|
586
|
+
* @param {?object} paginationOptions
|
|
587
|
+
* @param {number} paginationOptions.limit
|
|
588
|
+
* @param {number} paginationOptions.page
|
|
589
|
+
* @return {promise<Pagination>}
|
|
590
|
+
*/
|
|
591
|
+
paginate(paginationOptions?: {
|
|
592
|
+
limit?: number;
|
|
593
|
+
page?: number;
|
|
594
|
+
}): Promise<Pagination>;
|
|
595
|
+
/**
|
|
596
|
+
*
|
|
597
|
+
* execute data return object | null
|
|
598
|
+
* @return {promise<object | null>}
|
|
599
|
+
*/
|
|
600
|
+
first(): Promise<{
|
|
601
|
+
[key: string]: any;
|
|
602
|
+
} | null>;
|
|
603
|
+
/**
|
|
604
|
+
*
|
|
605
|
+
* execute data return object | throw rror
|
|
606
|
+
* @return {promise<object | null>}
|
|
607
|
+
*/
|
|
608
|
+
findOne(): Promise<{
|
|
609
|
+
[key: string]: any;
|
|
610
|
+
} | null>;
|
|
611
|
+
/**
|
|
612
|
+
*
|
|
613
|
+
* execute data return object | throw Error
|
|
614
|
+
* @return {promise<object | Error>}
|
|
615
|
+
*/
|
|
616
|
+
firstOrError(message: string, options?: {
|
|
617
|
+
[key: string]: any;
|
|
618
|
+
}): Promise<{
|
|
619
|
+
[key: string]: any;
|
|
620
|
+
}>;
|
|
621
|
+
/**
|
|
622
|
+
*
|
|
623
|
+
* execute data return object | null
|
|
624
|
+
* @return {promise<object | null>}
|
|
625
|
+
*/
|
|
626
|
+
findOneOrError(message: string, options?: {
|
|
627
|
+
[key: string]: any;
|
|
628
|
+
}): Promise<{
|
|
629
|
+
[key: string]: any;
|
|
630
|
+
}>;
|
|
631
|
+
/**
|
|
632
|
+
*
|
|
633
|
+
* execute data return Array
|
|
634
|
+
* @return {promise<Array<any>>}
|
|
635
|
+
*/
|
|
636
|
+
get(): Promise<Array<any>>;
|
|
637
|
+
/**
|
|
638
|
+
*
|
|
639
|
+
* execute data return Array
|
|
640
|
+
* @return {promise<Array<any>>}
|
|
641
|
+
*/
|
|
642
|
+
findMany(): Promise<Array<any>>;
|
|
643
|
+
/**
|
|
644
|
+
*
|
|
645
|
+
* execute data return json of result
|
|
646
|
+
* @return {promise<string>}
|
|
647
|
+
*/
|
|
648
|
+
toJSON(): Promise<string>;
|
|
649
|
+
/**
|
|
650
|
+
*
|
|
651
|
+
* execute data return array of results
|
|
652
|
+
* @param {string=} column [column=id]
|
|
653
|
+
* @return {promise<Array>}
|
|
654
|
+
*/
|
|
655
|
+
toArray(column?: string): Promise<Array<any>>;
|
|
656
|
+
/**
|
|
657
|
+
*
|
|
658
|
+
* execute data return number of results
|
|
659
|
+
* @param {string=} column [column=id]
|
|
660
|
+
* @return {promise<number>}
|
|
661
|
+
*/
|
|
662
|
+
count(column?: string): Promise<number>;
|
|
663
|
+
/**
|
|
664
|
+
*
|
|
665
|
+
* execute data return result is exists
|
|
666
|
+
* @return {promise<boolean>}
|
|
667
|
+
*/
|
|
668
|
+
exists(): Promise<boolean>;
|
|
669
|
+
/**
|
|
670
|
+
*
|
|
671
|
+
* execute data return average of results
|
|
672
|
+
* @param {string=} column [column=id]
|
|
673
|
+
* @return {promise<number>}
|
|
674
|
+
*/
|
|
675
|
+
avg(column?: string): Promise<number>;
|
|
676
|
+
/**
|
|
677
|
+
*
|
|
678
|
+
* execute data return summary of results
|
|
679
|
+
* @param {string=} column [column=id]
|
|
680
|
+
* @return {promise<number>}
|
|
681
|
+
*/
|
|
682
|
+
sum(column?: string): Promise<number>;
|
|
683
|
+
/**
|
|
684
|
+
*
|
|
685
|
+
* execute data return maximum of results
|
|
686
|
+
* @param {string=} column [column=id]
|
|
687
|
+
* @return {promise<number>}
|
|
688
|
+
*/
|
|
689
|
+
max(column?: string): Promise<number>;
|
|
690
|
+
/**
|
|
691
|
+
*
|
|
692
|
+
* execute data return minimum of results
|
|
693
|
+
* @param {string=} column [column=id]
|
|
694
|
+
* @return {promise<number>}
|
|
695
|
+
*/
|
|
696
|
+
min(column?: string): Promise<number>;
|
|
697
|
+
/**
|
|
698
|
+
*
|
|
699
|
+
* delete data from database
|
|
700
|
+
* @return {promise<boolean>}
|
|
701
|
+
*/
|
|
702
|
+
delete(): Promise<boolean>;
|
|
703
|
+
/**
|
|
704
|
+
*
|
|
705
|
+
* delete data from database ignore where condition
|
|
706
|
+
* @return {promise<boolean>}
|
|
707
|
+
*/
|
|
708
|
+
forceDelete(): Promise<boolean>;
|
|
709
|
+
/**
|
|
710
|
+
*
|
|
711
|
+
* execute data return Array *grouping results in column
|
|
712
|
+
* @param {string} column
|
|
713
|
+
* @return {promise<Array>}
|
|
714
|
+
*/
|
|
715
|
+
getGroupBy(column: string): Promise<Array<any>>;
|
|
716
|
+
/**
|
|
717
|
+
*
|
|
718
|
+
* execute data return grouping results by index
|
|
719
|
+
* @param {string} column
|
|
720
|
+
* @return {promise<Array>}
|
|
721
|
+
*/
|
|
722
|
+
findManyGroupBy(column: string): Promise<Array<any>>;
|
|
723
|
+
/**
|
|
724
|
+
* execute data when save *action [insert , update]
|
|
725
|
+
* @return {Promise<any>} promise
|
|
726
|
+
*/
|
|
727
|
+
save(): Promise<{
|
|
728
|
+
[key: string]: any;
|
|
729
|
+
} | Array<any> | null | undefined>;
|
|
730
|
+
/**
|
|
731
|
+
*
|
|
732
|
+
* show columns in table
|
|
733
|
+
* @param {string=} table table name
|
|
734
|
+
* @return {Promise<Array>}
|
|
735
|
+
*/
|
|
736
|
+
showColumns(table?: string): Promise<Array<string>>;
|
|
737
|
+
/**
|
|
738
|
+
*
|
|
739
|
+
* show schemas in table
|
|
740
|
+
* @param {string=} table [table= current table name]
|
|
741
|
+
* @return {Promise<Array>}
|
|
742
|
+
*/
|
|
743
|
+
showSchemas(table?: string): Promise<Array<string>>;
|
|
744
|
+
/**
|
|
745
|
+
*
|
|
746
|
+
* show values in table
|
|
747
|
+
* @param {string=} table table name
|
|
748
|
+
* @return {Promise<Array>}
|
|
749
|
+
*/
|
|
750
|
+
showValues(table?: string): Promise<Array<string>>;
|
|
751
|
+
/**
|
|
752
|
+
*
|
|
753
|
+
* backup this database intro new database same server or to another server
|
|
754
|
+
* @param {Object} backupOptions
|
|
755
|
+
* @param {string} backup.database
|
|
756
|
+
* @param {object?} backup.to
|
|
757
|
+
* @param {string} backup.to.host
|
|
758
|
+
* @param {number} backup.to.port
|
|
759
|
+
* @param {string} backup.to.database
|
|
760
|
+
* @param {string} backup.to.username
|
|
761
|
+
* @param {string} backup.to.password
|
|
762
|
+
|
|
763
|
+
* @return {Promise<boolean>}
|
|
764
|
+
*/
|
|
765
|
+
backup({ database, to }: Backup): Promise<boolean>;
|
|
766
|
+
/**
|
|
767
|
+
*
|
|
768
|
+
* backup database intro file
|
|
769
|
+
* @param {Object} backupOptions
|
|
770
|
+
* @param {string} backup.database
|
|
771
|
+
* @param {object?} backup.filePath
|
|
772
|
+
* @param {object?} backup.connection
|
|
773
|
+
* @param {string} backup.connection.host
|
|
774
|
+
* @param {number} backup.connection.port
|
|
775
|
+
* @param {string} backup.connection.database
|
|
776
|
+
* @param {string} backup.connection.username
|
|
777
|
+
* @param {string} backup.connection.password
|
|
778
|
+
|
|
779
|
+
* @return {Promise<boolean>}
|
|
780
|
+
*/
|
|
781
|
+
backupToFile({ filePath, database, connection }: BackupToFile): Promise<void>;
|
|
782
|
+
/**
|
|
783
|
+
*
|
|
784
|
+
* fake data
|
|
785
|
+
* @param {number} rows number of rows
|
|
786
|
+
* @return {promise<any>}
|
|
787
|
+
*/
|
|
788
|
+
faker(rows?: number): Promise<any>;
|
|
789
|
+
/**
|
|
790
|
+
*
|
|
791
|
+
* truncate of table
|
|
792
|
+
* @return {promise<boolean>}
|
|
793
|
+
*/
|
|
794
|
+
truncate(): Promise<boolean>;
|
|
795
|
+
/**
|
|
796
|
+
*
|
|
797
|
+
* drop of table
|
|
798
|
+
* @return {promise<boolean>}
|
|
799
|
+
*/
|
|
800
|
+
drop(): Promise<boolean>;
|
|
801
|
+
private _queryWhereIsExists;
|
|
802
|
+
private _bindTableAndColumnInQueryWhere;
|
|
803
|
+
private _insertNotExists;
|
|
804
|
+
protected queryStatement(sql: string): Promise<Array<any>>;
|
|
805
|
+
protected actionStatement({ sql, returnId }: {
|
|
806
|
+
sql: string;
|
|
807
|
+
returnId?: boolean;
|
|
808
|
+
}): Promise<any>;
|
|
809
|
+
private _insert;
|
|
810
|
+
private _checkValueHasRaw;
|
|
811
|
+
private _insertMultiple;
|
|
812
|
+
private _insertOrSelect;
|
|
813
|
+
private _updateOrInsert;
|
|
814
|
+
private _update;
|
|
815
|
+
private _hiddenColumn;
|
|
816
|
+
private _queryUpdate;
|
|
817
|
+
private _queryInsert;
|
|
818
|
+
private _queryInsertMultiple;
|
|
819
|
+
private _valueAndOperator;
|
|
820
|
+
private _valueTrueFalse;
|
|
821
|
+
private _buildQuery;
|
|
822
|
+
private _initialConnection;
|
|
823
|
+
}
|
|
824
|
+
export { Builder };
|
|
825
|
+
export default Builder;
|