query-core 0.0.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/src/build.ts ADDED
@@ -0,0 +1,683 @@
1
+ import {Attribute, Attributes, Statement, StringMap} from './metadata';
2
+
3
+ export function params(length: number, p: (i: number) => string, from?: number): string[] {
4
+ if (from === undefined || from == null) {
5
+ from = 0;
6
+ }
7
+ const ps: string[] = [];
8
+ for (let i = 1; i <= length; i++) {
9
+ ps.push(p(i + from));
10
+ }
11
+ return ps;
12
+ }
13
+ export function select<T>(obj: T, table: string, ks: Attribute[], buildParam: (i: number) => string, i?: number): Statement|undefined {
14
+ if (!i) {
15
+ i = 1;
16
+ }
17
+ if (ks.length === 1) {
18
+ const field = (ks[0].column ? ks[0].column : ks[0].name);
19
+ if (typeof obj === 'number') {
20
+ const query = `select * from ${table} where ${field} = ${obj}`;
21
+ return { query, params: [] };
22
+ } else {
23
+ const query = `select * from ${table} where ${field} = ${buildParam(i)}`;
24
+ return { query, params: [obj] };
25
+ }
26
+ } else if (ks.length > 1) {
27
+ const cols: string[] = [];
28
+ const args: any[] = [];
29
+ for (const k of ks) {
30
+ if (k.name) {
31
+ const field = (k.column ? k.column : k.name);
32
+ cols.push(`${field} = ${buildParam(i++)}`);
33
+ args.push((obj as any)[k.name]);
34
+ }
35
+ }
36
+ const query = `select * from ${table} where ${cols.join(' and ')}`;
37
+ return { query, params: args };
38
+ } else {
39
+ return undefined;
40
+ }
41
+ }
42
+ export function exist<T>(obj: T, table: string, ks: Attribute[], buildParam: (i: number) => string, col?: string, i?: number): Statement|undefined {
43
+ if (!i) {
44
+ i = 1;
45
+ }
46
+ if (!col || col.length === 0) {
47
+ col = '*';
48
+ }
49
+ if (ks.length === 1) {
50
+ const field = (ks[0].column ? ks[0].column : ks[0].name);
51
+ if (typeof obj === 'number') {
52
+ const query = `select ${col} from ${table} where ${field} = ${obj}`;
53
+ return { query, params: [] };
54
+ } else {
55
+ const query = `select ${col} from ${table} where ${field} = ${buildParam(i)}`;
56
+ return { query, params: [obj] };
57
+ }
58
+ } else if (ks.length > 1) {
59
+ const cols: string[] = [];
60
+ const args: any[] = [];
61
+ for (const k of ks) {
62
+ if (k.name) {
63
+ const field = (k.column ? k.column : k.name);
64
+ cols.push(`${field} = ${buildParam(i++)}`);
65
+ args.push((obj as any)[k.name]);
66
+ }
67
+ }
68
+ const query = `select * from ${table} where ${cols.join(' and ')}`;
69
+ return { query, params: args };
70
+ } else {
71
+ return undefined;
72
+ }
73
+ }
74
+ export function buildToDelete<T>(obj: T, table: string, ks: Attribute[], buildParam: (i: number) => string, i?: number): Statement|undefined {
75
+ if (!i) {
76
+ i = 1;
77
+ }
78
+ if (ks.length === 1) {
79
+ const field = (ks[0].column ? ks[0].column : ks[0].name);
80
+ if (typeof obj === 'number') {
81
+ const query = `delete from ${table} where ${field} = ${obj}`;
82
+ return { query, params: [] };
83
+ } else {
84
+ const query = `delete from ${table} where ${field} = ${buildParam(i)}`;
85
+ return { query, params: [obj] };
86
+ }
87
+ } else if (ks.length > 1) {
88
+ const cols: string[] = [];
89
+ const args: any[] = [];
90
+ for (const k of ks) {
91
+ if (k.name) {
92
+ const field = (k.column ? k.column : k.name);
93
+ cols.push(`${field} = ${buildParam(i++)}`);
94
+ args.push((obj as any)[k.name]);
95
+ }
96
+ }
97
+ const query = `delete from ${table} where ${cols.join(' and ')}`;
98
+ return { query, params: args };
99
+ } else {
100
+ return undefined;
101
+ }
102
+ }
103
+ export function insert<T>(exec: (sql: string, args?: any[]) => Promise<number>, obj: T, table: string, attrs: Attributes, buildParam: (i: number) => string, ver?: string, i?: number): Promise<number> {
104
+ const stm = buildToInsert(obj, table, attrs, buildParam, ver, i);
105
+ if (!stm) {
106
+ return Promise.resolve(0);
107
+ } else {
108
+ return exec(stm.query, stm.params);
109
+ }
110
+ }
111
+ export function buildToInsert<T>(obj: T, table: string, attrs: Attributes, buildParam: (i: number) => string, ver?: string, i?: number): Statement|undefined {
112
+ if (!i) {
113
+ i = 1;
114
+ }
115
+ const o: any = obj;
116
+ const ks = Object.keys(attrs);
117
+ const cols: string[] = [];
118
+ const values: string[] = [];
119
+ const args: any[] = [];
120
+ let isVersion = false;
121
+ for (const k of ks) {
122
+ let v = o[k];
123
+ const attr = attrs[k];
124
+ if (attr && !attr.ignored && !attr.noinsert) {
125
+ if (v === undefined || v == null) {
126
+ v = attr.default;
127
+ }
128
+ if (v !== undefined && v != null) {
129
+ const field = (attr.column ? attr.column : k);
130
+ cols.push(field);
131
+ if (k === ver) {
132
+ isVersion = true;
133
+ values.push(`${1}`);
134
+ } else {
135
+ if (v === '') {
136
+ values.push(`''`);
137
+ } else if (typeof v === 'number') {
138
+ values.push(toString(v));
139
+ } else if (typeof v === 'boolean') {
140
+ if (attr.true === undefined) {
141
+ if (v === true) {
142
+ values.push(`true`);
143
+ } else {
144
+ values.push(`false`);
145
+ }
146
+ } else {
147
+ const p = buildParam(i++);
148
+ values.push(p);
149
+ if (v === true) {
150
+ const v2 = (attr.true ? attr.true : '1');
151
+ args.push(v2);
152
+ } else {
153
+ const v2 = (attr.false ? attr.false : '0');
154
+ args.push(v2);
155
+ }
156
+ }
157
+ } else {
158
+ const p = buildParam(i++);
159
+ values.push(p);
160
+ args.push(v);
161
+ }
162
+ }
163
+ }
164
+ }
165
+ }
166
+ if (!isVersion && ver && ver.length > 0) {
167
+ const attr = attrs[ver];
168
+ const field = (attr.column ? attr.column : ver);
169
+ cols.push(field);
170
+ values.push(`${1}`);
171
+ }
172
+ if (cols.length === 0) {
173
+ return undefined;
174
+ } else {
175
+ const query = `insert into ${table}(${cols.join(',')})values(${values.join(',')})`;
176
+ return { query, params: args };
177
+ }
178
+ }
179
+ export function insertBatch<T>(exec: (sql: string, args?: any[]) => Promise<number>, objs: T[], table: string, attrs: Attributes, buildParam: ((i: number) => string)|boolean, ver?: string, i?: number): Promise<number> {
180
+ const stm = buildToInsertBatch(objs, table, attrs, buildParam, ver, i);
181
+ if (!stm) {
182
+ return Promise.resolve(0);
183
+ } else {
184
+ return exec(stm.query, stm.params);
185
+ }
186
+ }
187
+ function buildOracleParam(i: number): string {
188
+ return ':' + i;
189
+ }
190
+ export function buildToInsertBatch<T>(objs: T[], table: string, attrs: Attributes, buildParam: ((i: number) => string) | boolean, ver?: string, i?: number): Statement|undefined {
191
+ if (!i) {
192
+ i = 1;
193
+ }
194
+ const ks = Object.keys(attrs);
195
+ const args: any[] = [];
196
+ if (buildParam && typeof buildParam === 'function') {
197
+ const cols: string[] = [];
198
+ const rows: string[] = [];
199
+ for (const k of ks) {
200
+ const attr = attrs[k];
201
+ if (attr && !attr.ignored && !attr.noinsert) {
202
+ const field = (attr.column ? attr.column : k);
203
+ cols.push(field);
204
+ }
205
+ }
206
+ for (const obj of objs) {
207
+ const values: string[] = [];
208
+ for (const k of ks) {
209
+ const attr = attrs[k];
210
+ if (attr && !attr.ignored && !attr.noinsert) {
211
+ let v = (obj as any)[k];
212
+ if (v === undefined || v === null) {
213
+ v = attr.default;
214
+ }
215
+ // let x: string;
216
+ if (attr.version) {
217
+ values.push('1');
218
+ } else if (v === undefined || v == null) {
219
+ values.push('null');
220
+ } else if (v === '') {
221
+ values.push(`''`);
222
+ } else if (typeof v === 'number') {
223
+ values.push(toString(v));
224
+ } else if (typeof v === 'boolean') {
225
+ if (attr.true === undefined) {
226
+ if (v === true) {
227
+ values.push(`true`);
228
+ } else {
229
+ values.push(`false`);
230
+ }
231
+ } else {
232
+ const p = buildParam(i++);
233
+ values.push(p);
234
+ if (v === true) {
235
+ const v2 = (attr.true ? attr.true : '1');
236
+ args.push(v2);
237
+ } else {
238
+ const v2 = (attr.false ? attr.false : '0');
239
+ args.push(v2);
240
+ }
241
+ }
242
+ } else {
243
+ const p = buildParam(i++);
244
+ values.push(p);
245
+ args.push(v);
246
+ }
247
+ }
248
+ }
249
+ rows.push(`(${values.join(',')})`);
250
+ }
251
+ const query = `insert into ${table}(${cols.join(',')})values ${rows.join(',')}`;
252
+ return { query, params: args };
253
+ } else {
254
+ let notSkipInvalid = false;
255
+ if (buildParam === true) {
256
+ notSkipInvalid = true;
257
+ }
258
+ const rows: string[] = [];
259
+ for (const obj of objs) {
260
+ const cols: string[] = [];
261
+ const values: string[] = [];
262
+ let isVersion = false;
263
+ for (const k of ks) {
264
+ let v = (obj as any)[k];
265
+ const attr = attrs[k];
266
+ if (attr && !attr.ignored && !attr.noinsert) {
267
+ if (v === undefined || v == null) {
268
+ v = attr.default;
269
+ }
270
+ if (v !== undefined && v != null) {
271
+ const field = (attr.column ? attr.column : k);
272
+ cols.push(field);
273
+ if (k === ver) {
274
+ isVersion = true;
275
+ values.push(`${1}`);
276
+ } else {
277
+ if (v === '') {
278
+ values.push(`''`);
279
+ } else if (typeof v === 'number') {
280
+ values.push(toString(v));
281
+ } else if (typeof v === 'boolean') {
282
+ if (attr.true === undefined) {
283
+ if (v === true) {
284
+ values.push(`true`);
285
+ } else {
286
+ values.push(`false`);
287
+ }
288
+ } else {
289
+ const p = buildOracleParam(i++);
290
+ values.push(p);
291
+ if (v === true) {
292
+ const v2 = (attr.true ? attr.true : '1');
293
+ args.push(v2);
294
+ } else {
295
+ const v2 = (attr.false ? attr.false : '0');
296
+ args.push(v2);
297
+ }
298
+ }
299
+ } else {
300
+ const p = buildOracleParam(i++);
301
+ values.push(p);
302
+ args.push(v);
303
+ }
304
+ }
305
+ }
306
+ }
307
+ }
308
+ if (!isVersion && ver && ver.length > 0) {
309
+ const attr = attrs[ver];
310
+ const field = (attr.column ? attr.column : ver);
311
+ cols.push(field);
312
+ values.push(`${1}`);
313
+ }
314
+ if (cols.length === 0) {
315
+ if (notSkipInvalid) {
316
+ return undefined;
317
+ }
318
+ } else {
319
+ const s = `into ${table}(${cols.join(',')})values(${values.join(',')})`;
320
+ rows.push(s);
321
+ }
322
+ }
323
+ if (rows.length === 0) {
324
+ return undefined;
325
+ }
326
+ const query = `insert all ${rows.join(' ')} select * from dual`;
327
+ return { query, params: args };
328
+ }
329
+ }
330
+ export function update<T>(exec: (sql: string, args?: any[]) => Promise<number>, obj: T, table: string, attrs: Attributes, buildParam: (i: number) => string, ver?: string, i?: number): Promise<number> {
331
+ const stm = buildToUpdate(obj, table, attrs, buildParam, ver, i);
332
+ if (!stm) {
333
+ return Promise.resolve(0);
334
+ } else {
335
+ return exec(stm.query, stm.params);
336
+ }
337
+ }
338
+ export function buildToUpdate<T>(obj: T, table: string, attrs: Attributes, buildParam: (i: number) => string, ver?: string, i?: number): Statement|undefined {
339
+ if (!i) {
340
+ i = 1;
341
+ }
342
+ const o: any = obj;
343
+ const ks = Object.keys(attrs);
344
+ const pks: Attribute[] = [];
345
+ const colSet: string[] = [];
346
+ const colQuery: string[] = [];
347
+ const args: any[] = [];
348
+ for (const k of ks) {
349
+ const v = o[k];
350
+ if (v !== undefined) {
351
+ const attr = attrs[k];
352
+ attr.name = k;
353
+ if (attr && !attr.ignored && k !== ver) {
354
+ if (attr.key) {
355
+ pks.push(attr);
356
+ } else if (!attr.noupdate) {
357
+ const field = (attr.column ? attr.column : k);
358
+ let x: string;
359
+ if (v == null) {
360
+ x = 'null';
361
+ } else if (v === '') {
362
+ x = `''`;
363
+ } else if (typeof v === 'number') {
364
+ x = toString(v);
365
+ } else if (typeof v === 'boolean') {
366
+ if (attr.true === undefined) {
367
+ if (v === true) {
368
+ x = `true`;
369
+ } else {
370
+ x = `false`;
371
+ }
372
+ } else {
373
+ x = buildParam(i++);
374
+ if (v === true) {
375
+ const v2 = (attr.true ? attr.true : '1');
376
+ args.push(v2);
377
+ } else {
378
+ const v2 = (attr.false ? attr.false : '0');
379
+ args.push(v2);
380
+ }
381
+ }
382
+ } else {
383
+ x = buildParam(i++);
384
+ args.push(v);
385
+ }
386
+ colSet.push(`${field}=${x}`);
387
+ }
388
+ }
389
+ }
390
+ }
391
+ for (const pk of pks) {
392
+ const na = (pk.name ? pk.name : '');
393
+ const v = o[na];
394
+ if (!v) {
395
+ return undefined;
396
+ } else {
397
+ const attr = attrs[na];
398
+ const field = (attr.column ? attr.column : pk.name);
399
+ let x: string;
400
+ if (v == null) {
401
+ x = 'null';
402
+ } else if (v === '') {
403
+ x = `''`;
404
+ } else if (typeof v === 'number') {
405
+ x = toString(v);
406
+ } else {
407
+ x = buildParam(i++);
408
+ if (typeof v === 'boolean') {
409
+ if (v === true) {
410
+ const v2 = (attr.true ? '' + attr.true : '1');
411
+ args.push(v2);
412
+ } else {
413
+ const v2 = (attr.false ? '' + attr.false : '0');
414
+ args.push(v2);
415
+ }
416
+ } else {
417
+ args.push(v);
418
+ }
419
+ }
420
+ colQuery.push(`${field}=${x}`);
421
+ }
422
+ }
423
+ if (ver && ver.length > 0) {
424
+ const v = o[ver];
425
+ if (typeof v === 'number' && !isNaN(v)) {
426
+ const attr = attrs[ver];
427
+ if (attr) {
428
+ const field = (attr.column ? attr.column : ver);
429
+ colSet.push(`${field}=${(1 + v)}`);
430
+ colQuery.push(`${field}=${v}`);
431
+ }
432
+ }
433
+ }
434
+ if (colSet.length === 0 || colQuery.length === 0) {
435
+ return undefined;
436
+ } else {
437
+ const query = `update ${table} set ${colSet.join(',')} where ${colQuery.join(' and ')}`;
438
+ return { query, params: args };
439
+ }
440
+ }
441
+ export function updateBatch<T>(exec: (statements: Statement[]) => Promise<number>, objs: T[], table: string, attrs: Attributes, buildParam: (i: number) => string, notSkipInvalid?: boolean): Promise<number> {
442
+ const stmts = buildToUpdateBatch(objs, table, attrs, buildParam, notSkipInvalid);
443
+ if (!stmts || stmts.length === 0) {
444
+ return Promise.resolve(0);
445
+ } else {
446
+ return exec(stmts);
447
+ }
448
+ }
449
+ export function buildToUpdateBatch<T>(objs: T[], table: string, attrs: Attributes, buildParam: (i: number) => string, notSkipInvalid?: boolean): Statement[]|undefined {
450
+ const sts: Statement[] = [];
451
+ const meta = metadata(attrs);
452
+ if (!meta.keys || meta.keys.length === 0) {
453
+ return undefined;
454
+ }
455
+ for (const obj of objs) {
456
+ const o: any = obj;
457
+ let i = 1;
458
+ const ks = Object.keys(o);
459
+ const colSet: string[] = [];
460
+ const colQuery: string[] = [];
461
+ const args: any[] = [];
462
+ for (const k of ks) {
463
+ const v = o[k];
464
+ if (v !== undefined) {
465
+ const attr = attrs[k];
466
+ attr.name = k;
467
+ if (attr && !attr.ignored && !attr.key && !attr.version && !attr.noupdate) {
468
+ const field = (attr.column ? attr.column : k);
469
+ let x: string;
470
+ if (v == null) {
471
+ x = 'null';
472
+ } else if (v === '') {
473
+ x = `''`;
474
+ } else if (typeof v === 'number') {
475
+ x = toString(v);
476
+ } else if (typeof v === 'boolean') {
477
+ if (attr.true === undefined) {
478
+ if (v === true) {
479
+ x = `true`;
480
+ } else {
481
+ x = `false`;
482
+ }
483
+ } else {
484
+ x = buildParam(i++);
485
+ if (v === true) {
486
+ const v2 = (attr.true ? attr.true : '1');
487
+ args.push(v2);
488
+ } else {
489
+ const v2 = (attr.false ? attr.false : '0');
490
+ args.push(v2);
491
+ }
492
+ }
493
+ } else {
494
+ x = buildParam(i++);
495
+ args.push(v);
496
+ }
497
+ colSet.push(`${field}=${x}`);
498
+ }
499
+ }
500
+ }
501
+ let valid = true;
502
+ for (const pk of meta.keys) {
503
+ const na = (pk.name ? pk.name : '');
504
+ const v = o[na];
505
+ if (!v) {
506
+ valid = false;
507
+ } else {
508
+ const attr = attrs[na];
509
+ const field = (attr.column ? attr.column : pk.name);
510
+ let x: string;
511
+ if (v == null) {
512
+ x = 'null';
513
+ } else if (v === '') {
514
+ x = `''`;
515
+ } else if (typeof v === 'number') {
516
+ x = toString(v);
517
+ } else {
518
+ x = buildParam(i++);
519
+ if (typeof v === 'boolean') {
520
+ if (v === true) {
521
+ const v2 = (attr.true ? '' + attr.true : '1');
522
+ args.push(v2);
523
+ } else {
524
+ const v2 = (attr.false ? '' + attr.false : '0');
525
+ args.push(v2);
526
+ }
527
+ } else {
528
+ args.push(v);
529
+ }
530
+ }
531
+ colQuery.push(`${field}=${x}`);
532
+ }
533
+ }
534
+ if (!valid || colSet.length === 0 || colQuery.length === 0) {
535
+ if (notSkipInvalid) {
536
+ return undefined;
537
+ }
538
+ } else {
539
+ const ver = meta.version;
540
+ if (ver && ver.length > 0) {
541
+ const v = o[ver];
542
+ if (typeof v === 'number' && !isNaN(v)) {
543
+ const attr = attrs[ver];
544
+ if (attr) {
545
+ const field = (attr.column ? attr.column : ver);
546
+ colSet.push(`${field}=${(1 + v)}`);
547
+ colQuery.push(`${field}=${v}`);
548
+ }
549
+ }
550
+ }
551
+ const query = `update ${table} set ${colSet.join(',')} where ${colQuery.join(' and ')}`;
552
+ const stm: Statement = { query, params: args };
553
+ sts.push(stm);
554
+ }
555
+ }
556
+ return sts;
557
+ }
558
+ export function version(attrs: Attributes): Attribute|undefined {
559
+ const ks = Object.keys(attrs);
560
+ for (const k of ks) {
561
+ const attr = attrs[k];
562
+ if (attr.version) {
563
+ attr.name = k;
564
+ return attr;
565
+ }
566
+ }
567
+ return undefined;
568
+ }
569
+ export function key(attrs: Attributes): Attribute|undefined {
570
+ const ks = Object.keys(attrs);
571
+ for (const k of ks) {
572
+ const attr = attrs[k];
573
+ attr.name = k;
574
+ if (attr.key) {
575
+ return attr;
576
+ }
577
+ }
578
+ return undefined;
579
+ }
580
+ export function keys(attrs: Attributes): Attribute[] {
581
+ const ks = Object.keys(attrs);
582
+ const ats: Attribute[] = [];
583
+ for (const k of ks) {
584
+ const attr = attrs[k];
585
+ attr.name = k;
586
+ if (attr.key) {
587
+ ats.push(attr);
588
+ }
589
+ }
590
+ return ats;
591
+ }
592
+ export function buildMap(attrs: Attributes): StringMap {
593
+ const mp: StringMap = {};
594
+ const ks = Object.keys(attrs);
595
+ for (const k of ks) {
596
+ const attr = attrs[k];
597
+ attr.name = k;
598
+ const field = (attr.column ? attr.column : k);
599
+ const s = field.toLowerCase();
600
+ if (s !== k) {
601
+ mp[s] = k;
602
+ }
603
+ }
604
+ return mp;
605
+ }
606
+ export interface Metadata {
607
+ keys: Attribute[];
608
+ bools?: Attribute[];
609
+ map?: StringMap;
610
+ version?: string;
611
+ fields?: string[];
612
+ }
613
+ export function metadata(attrs: Attributes): Metadata {
614
+ const mp: StringMap = {};
615
+ const ks = Object.keys(attrs);
616
+ const ats: Attribute[] = [];
617
+ const bools: Attribute[] = [];
618
+ const fields: string[] = [];
619
+ let isMap = false;
620
+ const m: Metadata = {keys: ats, fields};
621
+ for (const k of ks) {
622
+ const attr = attrs[k];
623
+ attr.name = k;
624
+ if (attr.key) {
625
+ ats.push(attr);
626
+ }
627
+ if (!attr.ignored) {
628
+ fields.push(k);
629
+ }
630
+ if (attr.type === 'boolean') {
631
+ bools.push(attr);
632
+ }
633
+ if (attr.version) {
634
+ m.version = k;
635
+ }
636
+ const field = (attr.column ? attr.column : k);
637
+ const s = field.toLowerCase();
638
+ if (s !== k) {
639
+ mp[s] = k;
640
+ isMap = true;
641
+ }
642
+ }
643
+ if (isMap) {
644
+ m.map = mp;
645
+ }
646
+ if (bools.length > 0) {
647
+ m.bools = bools;
648
+ }
649
+ return m;
650
+ }
651
+ export function attributes(attrs: string[], isKey?: boolean) {
652
+ const ks: Attribute[] = [];
653
+ for (const s of attrs) {
654
+ const a: Attribute = {name: s, column: s, key: isKey};
655
+ ks.push(a);
656
+ }
657
+ return ks;
658
+ }
659
+ export function param(i: number): string {
660
+ return '?';
661
+ }
662
+ export function setValue<T, V>(obj: T, path: string, value: V): void {
663
+ const paths = path.split('.');
664
+ let o: any = obj;
665
+ for (let i = 0; i < paths.length - 1; i++) {
666
+ const p = paths[i];
667
+ if (p in o) {
668
+ o = o[p];
669
+ } else {
670
+ o[p] = {};
671
+ o = o[p];
672
+ }
673
+ }
674
+ o[paths[paths.length - 1]] = value;
675
+ }
676
+ const n = 'NaN';
677
+ export function toString(v: number): string {
678
+ let x = '' + v;
679
+ if (x === n) {
680
+ x = 'null';
681
+ }
682
+ return x;
683
+ }
package/src/index.ts ADDED
@@ -0,0 +1,17 @@
1
+ export * from './metadata';
2
+ export * from './build';
3
+ export * from './batch';
4
+
5
+ export interface Config {
6
+ connectString?: string | undefined;
7
+ host?: string | undefined;
8
+ port?: number;
9
+ server?: string | undefined;
10
+ database?: string | undefined;
11
+ user?: string | undefined;
12
+ password?: string | undefined;
13
+ multipleStatements?: boolean | undefined;
14
+ max?: number | undefined;
15
+ min?: number | undefined;
16
+ idleTimeoutMillis?: number | undefined;
17
+ }