zormz 1.5.0 → 1.6.1
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 +208 -4
- package/dist/index.d.mts +123 -10
- package/dist/index.d.ts +123 -10
- package/dist/index.js +157 -46
- package/dist/index.mjs +152 -46
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -364,7 +364,212 @@ MENOR('edad', 18)
|
|
|
364
364
|
```
|
|
365
365
|
---
|
|
366
366
|
|
|
367
|
-
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
## Complementos de Select (Funciones agregadas SQL)
|
|
370
|
+
|
|
371
|
+
Este módulo proporciona **funciones auxiliares** para facilitar el uso de funciones agregadas SQL dentro de tu sistema de consultas usando `DB.Select()`.
|
|
372
|
+
|
|
373
|
+
Actualmente incluye soporte para:
|
|
374
|
+
|
|
375
|
+
* AVG
|
|
376
|
+
* COUNT
|
|
377
|
+
* MIN
|
|
378
|
+
* MAX
|
|
379
|
+
|
|
380
|
+
Estas funciones permiten generar expresiones SQL limpias, reutilizables y tipadas desde TypeScript.
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
# Uso general
|
|
387
|
+
|
|
388
|
+
Todas las funciones reciben:
|
|
389
|
+
|
|
390
|
+
```ts
|
|
391
|
+
(nombreColumna, aliasOpcional)
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
Donde:
|
|
395
|
+
|
|
396
|
+
| Parámetro | Tipo | Descripción |
|
|
397
|
+
| --------- | ----------------- | ---------------------------------- |
|
|
398
|
+
| columna | string | Nombre de la columna de la tabla |
|
|
399
|
+
| alias | string (opcional) | Nombre personalizado del resultado |
|
|
400
|
+
|
|
401
|
+
Retornan:
|
|
402
|
+
|
|
403
|
+
```ts
|
|
404
|
+
string
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
Lista para ser usada dentro de `DB.Select()`.
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
# Funciones disponibles
|
|
412
|
+
|
|
413
|
+
## AVG()
|
|
414
|
+
|
|
415
|
+
Calcula el promedio de una columna.
|
|
416
|
+
|
|
417
|
+
```ts
|
|
418
|
+
const [resultado] = await DB.Select([
|
|
419
|
+
AVG(usuarios.iduser, "promedio")
|
|
420
|
+
])
|
|
421
|
+
.from(usuarios())
|
|
422
|
+
.execute();
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
Resultado:
|
|
426
|
+
|
|
427
|
+
```ts
|
|
428
|
+
{ promedio: '4.0000000000000000' }
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
## COUNT()
|
|
434
|
+
|
|
435
|
+
Cuenta la cantidad de registros.
|
|
436
|
+
|
|
437
|
+
```ts
|
|
438
|
+
const datos = await DB.Select([
|
|
439
|
+
COUNT(usuarios.iduser, "cantidad")
|
|
440
|
+
])
|
|
441
|
+
.from(usuarios())
|
|
442
|
+
.execute();
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
Resultado:
|
|
446
|
+
|
|
447
|
+
```ts
|
|
448
|
+
[ { cantidad: 9 } ]
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
## MIN()
|
|
454
|
+
|
|
455
|
+
Obtiene el valor mínimo de una columna.
|
|
456
|
+
|
|
457
|
+
```ts
|
|
458
|
+
const datos = await DB.Select([
|
|
459
|
+
MIN(usuarios.iduser, "minimo")
|
|
460
|
+
])
|
|
461
|
+
.from(usuarios())
|
|
462
|
+
.execute();
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
Resultado:
|
|
466
|
+
|
|
467
|
+
```ts
|
|
468
|
+
[ { minimo: 1 } ]
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
## MAX()
|
|
474
|
+
|
|
475
|
+
Obtiene el valor máximo de una columna.
|
|
476
|
+
|
|
477
|
+
```ts
|
|
478
|
+
const [datos] = await DB.Select([
|
|
479
|
+
MAX(usuarios.iduser, "maximo")
|
|
480
|
+
])
|
|
481
|
+
.from(usuarios())
|
|
482
|
+
.execute();
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
Resultado:
|
|
486
|
+
|
|
487
|
+
```ts
|
|
488
|
+
{ maximo: 7 }
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
---
|
|
492
|
+
|
|
493
|
+
# Alias (pseudoNombre)
|
|
494
|
+
|
|
495
|
+
El segundo parámetro permite definir el nombre del campo retornado:
|
|
496
|
+
|
|
497
|
+
```ts
|
|
498
|
+
AVG("usuarios.edad", "edad_promedio")
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
Genera internamente:
|
|
502
|
+
|
|
503
|
+
```sql
|
|
504
|
+
AVG(usuarios.edad) AS edad_promedio
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
Si no se especifica alias:
|
|
508
|
+
|
|
509
|
+
```ts
|
|
510
|
+
AVG("usuarios.edad")
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
Genera:
|
|
514
|
+
|
|
515
|
+
```sql
|
|
516
|
+
AVG(usuarios.edad)
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
---
|
|
520
|
+
|
|
521
|
+
# Ejemplo completo
|
|
522
|
+
|
|
523
|
+
```ts
|
|
524
|
+
const resultado = await DB.Select([
|
|
525
|
+
COUNT(usuarios.iduser, "total"),
|
|
526
|
+
MAX(usuarios.iduser, "mayor"),
|
|
527
|
+
MIN(usuarios.iduser, "menor"),
|
|
528
|
+
AVG(usuarios.iduser, "promedio")
|
|
529
|
+
])
|
|
530
|
+
.from(usuarios())
|
|
531
|
+
.execute();
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
Resultado:
|
|
535
|
+
|
|
536
|
+
```ts
|
|
537
|
+
[
|
|
538
|
+
{
|
|
539
|
+
total: 9,
|
|
540
|
+
mayor: 7,
|
|
541
|
+
menor: 1,
|
|
542
|
+
promedio: "4.0000000000000000"
|
|
543
|
+
}
|
|
544
|
+
]
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
---
|
|
548
|
+
|
|
549
|
+
# Objetivo del módulo
|
|
550
|
+
|
|
551
|
+
Este módulo existe para:
|
|
552
|
+
|
|
553
|
+
* Evitar escribir SQL manual repetitivo
|
|
554
|
+
* Mejorar legibilidad del código
|
|
555
|
+
* Mantener consistencia en alias
|
|
556
|
+
* Facilitar composición de consultas dinámicas
|
|
557
|
+
* Integrarse naturalmente con `DB.Select()`
|
|
558
|
+
|
|
559
|
+
---
|
|
560
|
+
|
|
561
|
+
# Próximas mejoras sugeridas
|
|
562
|
+
|
|
563
|
+
Puedes ampliar fácilmente el módulo agregando:
|
|
564
|
+
|
|
565
|
+
* SUM()
|
|
566
|
+
* ROUND()
|
|
567
|
+
|
|
568
|
+
Siguiendo exactamente el mismo patrón usado aquí.
|
|
569
|
+
|
|
570
|
+
---
|
|
571
|
+
|
|
572
|
+
## Ejemplo de Uso ZORMZ
|
|
368
573
|
|
|
369
574
|
```ts
|
|
370
575
|
import {
|
|
@@ -429,9 +634,8 @@ pruebaData().catch(console.error);
|
|
|
429
634
|
- ORM en version inicial con enfoque de tipado y autompletado
|
|
430
635
|
- Compatible con **MYSQL** y **PG**
|
|
431
636
|
- Preparado para extenderse
|
|
432
|
-
- Las versiones +1.
|
|
433
|
-
- version estable 1.
|
|
434
|
-
- Se corrigio la compatiblidad de PG al momento de realizar Insert :c losiento
|
|
637
|
+
- Las versiones +1.5.0 son mas estables , las anteriores estaban en desarrollo y presentan multiples errores
|
|
638
|
+
- version estable 1.5.0
|
|
435
639
|
|
|
436
640
|
## Licencia
|
|
437
641
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
interface ResultSetHeaderMysql {
|
|
2
|
+
fieldCount: number;
|
|
3
|
+
affectedRows: number;
|
|
4
|
+
insertId: number;
|
|
5
|
+
info: string;
|
|
6
|
+
serverStatus: number;
|
|
7
|
+
warningStatus: number;
|
|
8
|
+
changedRows: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface ResultPG {
|
|
12
|
+
ok: boolean;
|
|
13
|
+
command?: "SELECT" | "INSERT" | "UPDATE" | "DELETE" | "DDL" | "DROP";
|
|
14
|
+
rowCount: number | null;
|
|
15
|
+
oid?: number | null;
|
|
16
|
+
rows?: any[];
|
|
17
|
+
fields?: any[];
|
|
18
|
+
rowAsArray?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
1
21
|
type ColumnTypes =
|
|
2
22
|
| "varchar"
|
|
3
23
|
| "int"
|
|
@@ -36,6 +56,13 @@ interface UpdateParams {
|
|
|
36
56
|
campoUp: string;
|
|
37
57
|
newCampoUp: string;
|
|
38
58
|
dataTable?: boolean;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
interface roundInd {
|
|
63
|
+
columna: string;
|
|
64
|
+
decimales: number;
|
|
65
|
+
pseudonombre?: string;
|
|
39
66
|
}
|
|
40
67
|
|
|
41
68
|
interface connecionLocal {
|
|
@@ -62,7 +89,7 @@ declare class BDconnection {
|
|
|
62
89
|
constructor(bd: connectionDB, datos: connecionLocal | connecionRed);
|
|
63
90
|
private conexionMysql;
|
|
64
91
|
private connectionPG;
|
|
65
|
-
executeConsulta({ query, valores, mensaje, alertar, }: Consultas): Promise<any>;
|
|
92
|
+
executeConsulta({ query, valores, mensaje, alertar, }: Consultas): Promise<ResultPG | ResultSetHeaderMysql | any>;
|
|
66
93
|
}
|
|
67
94
|
declare function getTipoConexion(): connectionDB;
|
|
68
95
|
/**
|
|
@@ -140,7 +167,7 @@ declare class QueryBuilder {
|
|
|
140
167
|
*
|
|
141
168
|
* @param {arrayData | arrayDatas} values
|
|
142
169
|
* @example
|
|
143
|
-
* //para un
|
|
170
|
+
* //para un solo dato
|
|
144
171
|
* ['dato1','dato2']
|
|
145
172
|
* //para varios datos
|
|
146
173
|
* [['dato1','dato1/2'],['dato2','dato2/2']]
|
|
@@ -167,6 +194,7 @@ declare class Select {
|
|
|
167
194
|
private limit;
|
|
168
195
|
private condicion;
|
|
169
196
|
private orderBy;
|
|
197
|
+
private offset;
|
|
170
198
|
/**
|
|
171
199
|
* @param {string[]} parametros - campo obligatorio
|
|
172
200
|
* @param {string} tabla - nombre de la ta tabla - campo obligatorio
|
|
@@ -202,6 +230,14 @@ declare class Select {
|
|
|
202
230
|
* @param {Number} cantidad
|
|
203
231
|
*/
|
|
204
232
|
LIMIT(cantidad?: number): this;
|
|
233
|
+
/**
|
|
234
|
+
*
|
|
235
|
+
* @param {number} cant
|
|
236
|
+
* @returns
|
|
237
|
+
* @example
|
|
238
|
+
* .LIMIT(10).OFFSET(10).execute()
|
|
239
|
+
*/
|
|
240
|
+
OFFSET(cant: number): this;
|
|
205
241
|
/**
|
|
206
242
|
*
|
|
207
243
|
* @param {String} texto
|
|
@@ -209,7 +245,7 @@ declare class Select {
|
|
|
209
245
|
/**
|
|
210
246
|
* @returns {Promise<Array<Object>>}
|
|
211
247
|
*/
|
|
212
|
-
execute(see?: boolean): Promise<any[]
|
|
248
|
+
execute(see?: boolean): Promise<any[]>;
|
|
213
249
|
}
|
|
214
250
|
|
|
215
251
|
type Valores = Record<string, string | number | undefined>;
|
|
@@ -268,7 +304,7 @@ declare class DB {
|
|
|
268
304
|
static Delete(nombreTabla: string): DeleteR;
|
|
269
305
|
}
|
|
270
306
|
|
|
271
|
-
type Valor = string | number | boolean;
|
|
307
|
+
type Valor = string | number | boolean | null;
|
|
272
308
|
/**
|
|
273
309
|
*
|
|
274
310
|
* @param {(string | number | boolean )} valor1 - eq(val,val1)
|
|
@@ -277,18 +313,18 @@ type Valor = string | number | boolean;
|
|
|
277
313
|
* //para varios condiciones
|
|
278
314
|
* AND(eq(),eq(),eq(),eq(),OR())
|
|
279
315
|
*/
|
|
280
|
-
declare const AND: (...valor1:
|
|
281
|
-
declare function ANDD(valores: string[]): string;
|
|
316
|
+
declare const AND: (...valor1: (string | null)[]) => string;
|
|
317
|
+
declare function ANDD(valores: (string | null)[]): string;
|
|
282
318
|
/**
|
|
283
319
|
*
|
|
284
|
-
* @param {
|
|
320
|
+
* @param {string} valor1 - eq(val,val1)
|
|
285
321
|
* @example
|
|
286
322
|
* //para una sola condicion
|
|
287
323
|
* OR(eq())
|
|
288
324
|
* //para varios condiciones
|
|
289
325
|
* OR(eq(),eq(),eq(),eq(),AND())
|
|
290
326
|
*/
|
|
291
|
-
declare const OR: (...valor1:
|
|
327
|
+
declare const OR: (...valor1: (string | null)[]) => string;
|
|
292
328
|
/**
|
|
293
329
|
*
|
|
294
330
|
* @param {string} valores
|
|
@@ -296,7 +332,7 @@ declare const OR: (...valor1: Valor[]) => string;
|
|
|
296
332
|
* @example
|
|
297
333
|
* ORD([eq(),eq()])
|
|
298
334
|
*/
|
|
299
|
-
declare const ORD: (valores: string[]) => string;
|
|
335
|
+
declare const ORD: (valores: (string | null)[]) => string;
|
|
300
336
|
/**
|
|
301
337
|
*
|
|
302
338
|
* @param {Valor} condicion1
|
|
@@ -500,4 +536,81 @@ declare class Money {
|
|
|
500
536
|
}
|
|
501
537
|
declare function money(presicion?: number, decimales?: number): Money;
|
|
502
538
|
|
|
503
|
-
|
|
539
|
+
/**
|
|
540
|
+
*
|
|
541
|
+
* @param {string} columna - campo de la tabla
|
|
542
|
+
* @param {string | undefined} pseudoNombre - nombre columna
|
|
543
|
+
* @return {string}
|
|
544
|
+
* @example
|
|
545
|
+
*
|
|
546
|
+
* const [promedio] = await DB.Select([AVG(usuarios.iduser, "promedio")])
|
|
547
|
+
.from(usuarios())
|
|
548
|
+
.execute();
|
|
549
|
+
* =>{ promedio: '4.0000000000000000' }
|
|
550
|
+
*/
|
|
551
|
+
declare const AVG: (columna: string, pseudoNombre?: string) => string;
|
|
552
|
+
/**
|
|
553
|
+
*
|
|
554
|
+
* @param {string} columna
|
|
555
|
+
* @param {string} pseudonombre
|
|
556
|
+
* @returns {string}
|
|
557
|
+
* @example
|
|
558
|
+
*
|
|
559
|
+
* COUNT(usuarios.iduser,"primero")
|
|
560
|
+
* //uso
|
|
561
|
+
* await DB.Select([COUNT(usuarios.iduser,"cantidad")]).from(usuarios()).execute();
|
|
562
|
+
* => [ { cantidad: 9 } ]
|
|
563
|
+
*/
|
|
564
|
+
declare const COUNT: (columna: string, pseudonombre?: string) => string;
|
|
565
|
+
/**
|
|
566
|
+
*
|
|
567
|
+
* @param {string} columna
|
|
568
|
+
* @param {string} pseudonombre
|
|
569
|
+
* @returns {string}
|
|
570
|
+
* @example
|
|
571
|
+
*
|
|
572
|
+
* MIN(usuarios.iduser,"primero")
|
|
573
|
+
* //uso
|
|
574
|
+
* await DB.Select([MIN(usuarios.iduser,"minimo")]).from(usuarios()).execute();
|
|
575
|
+
* => [ { minimo: 1 } ]
|
|
576
|
+
*/
|
|
577
|
+
declare const MIN: (columna: string, pseudonombre?: string) => string;
|
|
578
|
+
/**
|
|
579
|
+
*
|
|
580
|
+
* @param {string} columna
|
|
581
|
+
* @param {string} pseudonombre
|
|
582
|
+
* @returns {string}
|
|
583
|
+
* @example
|
|
584
|
+
*
|
|
585
|
+
* MAX(usuarios.iduser,"primero")
|
|
586
|
+
* //uso
|
|
587
|
+
* const [datos2] = await DB.Select([MAX(usuarios.iduser,"maximo")]).from(usuarios()).execute();
|
|
588
|
+
* => { maximo: 7 }
|
|
589
|
+
*/
|
|
590
|
+
declare const MAX: (columna: string, pseudonombre?: string) => string;
|
|
591
|
+
/**
|
|
592
|
+
*
|
|
593
|
+
* @param {string} columna
|
|
594
|
+
* @param {string} pseudonombre
|
|
595
|
+
* @returns {string}
|
|
596
|
+
* @example
|
|
597
|
+
*
|
|
598
|
+
* SUM(usuarios.iduser,"primero")
|
|
599
|
+
* //uso
|
|
600
|
+
* const [datos2] = await DB.Select([SUM(usuarios.iduser,"suma")]).from(usuarios()).execute();
|
|
601
|
+
* => { suma: 12 }
|
|
602
|
+
*/
|
|
603
|
+
declare const SUM: (columna: string, pseudonombre?: string) => string;
|
|
604
|
+
/**
|
|
605
|
+
*
|
|
606
|
+
* @param {roundInd} param
|
|
607
|
+
* @returns
|
|
608
|
+
* *
|
|
609
|
+
* ROUND(usuarios.dinero,2,"precioAlterado")
|
|
610
|
+
* //uso
|
|
611
|
+
* const [datos2] = await DB.Select([(usuarios.dinero,"precioalterado")]).from(usuarios()).execute();
|
|
612
|
+
* => { precioalterado: 12.22}
|
|
613
|
+
*/
|
|
614
|
+
declare const ROUND: ({ columna, decimales, pseudonombre }: roundInd) => string;
|
|
615
|
+
|
|
616
|
+
export { AND, ANDD, AVG, BDconnection, COUNT, CURRENT_TIMESTAMP, type Consultas, DB, DeleteR, ILIKE, MAX, MAYOR, MENOR, MIN, NOTNULL, NOW, NULL, OR, ORD, ORQ, ORQD, QueryBuilder, ROUND, SUM, Select, type TableProxy, type Tipos, UP, Update, type Valores, type arrayData, type arrayDatas, bool, type connecionLocal, type connecionRed, type connectionDB, defineTable, dropTable, eq, generateTable, getConexion, getRed, getTipoConexion, int, money, neq, timestamp, type valor, varchar };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
interface ResultSetHeaderMysql {
|
|
2
|
+
fieldCount: number;
|
|
3
|
+
affectedRows: number;
|
|
4
|
+
insertId: number;
|
|
5
|
+
info: string;
|
|
6
|
+
serverStatus: number;
|
|
7
|
+
warningStatus: number;
|
|
8
|
+
changedRows: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface ResultPG {
|
|
12
|
+
ok: boolean;
|
|
13
|
+
command?: "SELECT" | "INSERT" | "UPDATE" | "DELETE" | "DDL" | "DROP";
|
|
14
|
+
rowCount: number | null;
|
|
15
|
+
oid?: number | null;
|
|
16
|
+
rows?: any[];
|
|
17
|
+
fields?: any[];
|
|
18
|
+
rowAsArray?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
1
21
|
type ColumnTypes =
|
|
2
22
|
| "varchar"
|
|
3
23
|
| "int"
|
|
@@ -36,6 +56,13 @@ interface UpdateParams {
|
|
|
36
56
|
campoUp: string;
|
|
37
57
|
newCampoUp: string;
|
|
38
58
|
dataTable?: boolean;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
interface roundInd {
|
|
63
|
+
columna: string;
|
|
64
|
+
decimales: number;
|
|
65
|
+
pseudonombre?: string;
|
|
39
66
|
}
|
|
40
67
|
|
|
41
68
|
interface connecionLocal {
|
|
@@ -62,7 +89,7 @@ declare class BDconnection {
|
|
|
62
89
|
constructor(bd: connectionDB, datos: connecionLocal | connecionRed);
|
|
63
90
|
private conexionMysql;
|
|
64
91
|
private connectionPG;
|
|
65
|
-
executeConsulta({ query, valores, mensaje, alertar, }: Consultas): Promise<any>;
|
|
92
|
+
executeConsulta({ query, valores, mensaje, alertar, }: Consultas): Promise<ResultPG | ResultSetHeaderMysql | any>;
|
|
66
93
|
}
|
|
67
94
|
declare function getTipoConexion(): connectionDB;
|
|
68
95
|
/**
|
|
@@ -140,7 +167,7 @@ declare class QueryBuilder {
|
|
|
140
167
|
*
|
|
141
168
|
* @param {arrayData | arrayDatas} values
|
|
142
169
|
* @example
|
|
143
|
-
* //para un
|
|
170
|
+
* //para un solo dato
|
|
144
171
|
* ['dato1','dato2']
|
|
145
172
|
* //para varios datos
|
|
146
173
|
* [['dato1','dato1/2'],['dato2','dato2/2']]
|
|
@@ -167,6 +194,7 @@ declare class Select {
|
|
|
167
194
|
private limit;
|
|
168
195
|
private condicion;
|
|
169
196
|
private orderBy;
|
|
197
|
+
private offset;
|
|
170
198
|
/**
|
|
171
199
|
* @param {string[]} parametros - campo obligatorio
|
|
172
200
|
* @param {string} tabla - nombre de la ta tabla - campo obligatorio
|
|
@@ -202,6 +230,14 @@ declare class Select {
|
|
|
202
230
|
* @param {Number} cantidad
|
|
203
231
|
*/
|
|
204
232
|
LIMIT(cantidad?: number): this;
|
|
233
|
+
/**
|
|
234
|
+
*
|
|
235
|
+
* @param {number} cant
|
|
236
|
+
* @returns
|
|
237
|
+
* @example
|
|
238
|
+
* .LIMIT(10).OFFSET(10).execute()
|
|
239
|
+
*/
|
|
240
|
+
OFFSET(cant: number): this;
|
|
205
241
|
/**
|
|
206
242
|
*
|
|
207
243
|
* @param {String} texto
|
|
@@ -209,7 +245,7 @@ declare class Select {
|
|
|
209
245
|
/**
|
|
210
246
|
* @returns {Promise<Array<Object>>}
|
|
211
247
|
*/
|
|
212
|
-
execute(see?: boolean): Promise<any[]
|
|
248
|
+
execute(see?: boolean): Promise<any[]>;
|
|
213
249
|
}
|
|
214
250
|
|
|
215
251
|
type Valores = Record<string, string | number | undefined>;
|
|
@@ -268,7 +304,7 @@ declare class DB {
|
|
|
268
304
|
static Delete(nombreTabla: string): DeleteR;
|
|
269
305
|
}
|
|
270
306
|
|
|
271
|
-
type Valor = string | number | boolean;
|
|
307
|
+
type Valor = string | number | boolean | null;
|
|
272
308
|
/**
|
|
273
309
|
*
|
|
274
310
|
* @param {(string | number | boolean )} valor1 - eq(val,val1)
|
|
@@ -277,18 +313,18 @@ type Valor = string | number | boolean;
|
|
|
277
313
|
* //para varios condiciones
|
|
278
314
|
* AND(eq(),eq(),eq(),eq(),OR())
|
|
279
315
|
*/
|
|
280
|
-
declare const AND: (...valor1:
|
|
281
|
-
declare function ANDD(valores: string[]): string;
|
|
316
|
+
declare const AND: (...valor1: (string | null)[]) => string;
|
|
317
|
+
declare function ANDD(valores: (string | null)[]): string;
|
|
282
318
|
/**
|
|
283
319
|
*
|
|
284
|
-
* @param {
|
|
320
|
+
* @param {string} valor1 - eq(val,val1)
|
|
285
321
|
* @example
|
|
286
322
|
* //para una sola condicion
|
|
287
323
|
* OR(eq())
|
|
288
324
|
* //para varios condiciones
|
|
289
325
|
* OR(eq(),eq(),eq(),eq(),AND())
|
|
290
326
|
*/
|
|
291
|
-
declare const OR: (...valor1:
|
|
327
|
+
declare const OR: (...valor1: (string | null)[]) => string;
|
|
292
328
|
/**
|
|
293
329
|
*
|
|
294
330
|
* @param {string} valores
|
|
@@ -296,7 +332,7 @@ declare const OR: (...valor1: Valor[]) => string;
|
|
|
296
332
|
* @example
|
|
297
333
|
* ORD([eq(),eq()])
|
|
298
334
|
*/
|
|
299
|
-
declare const ORD: (valores: string[]) => string;
|
|
335
|
+
declare const ORD: (valores: (string | null)[]) => string;
|
|
300
336
|
/**
|
|
301
337
|
*
|
|
302
338
|
* @param {Valor} condicion1
|
|
@@ -500,4 +536,81 @@ declare class Money {
|
|
|
500
536
|
}
|
|
501
537
|
declare function money(presicion?: number, decimales?: number): Money;
|
|
502
538
|
|
|
503
|
-
|
|
539
|
+
/**
|
|
540
|
+
*
|
|
541
|
+
* @param {string} columna - campo de la tabla
|
|
542
|
+
* @param {string | undefined} pseudoNombre - nombre columna
|
|
543
|
+
* @return {string}
|
|
544
|
+
* @example
|
|
545
|
+
*
|
|
546
|
+
* const [promedio] = await DB.Select([AVG(usuarios.iduser, "promedio")])
|
|
547
|
+
.from(usuarios())
|
|
548
|
+
.execute();
|
|
549
|
+
* =>{ promedio: '4.0000000000000000' }
|
|
550
|
+
*/
|
|
551
|
+
declare const AVG: (columna: string, pseudoNombre?: string) => string;
|
|
552
|
+
/**
|
|
553
|
+
*
|
|
554
|
+
* @param {string} columna
|
|
555
|
+
* @param {string} pseudonombre
|
|
556
|
+
* @returns {string}
|
|
557
|
+
* @example
|
|
558
|
+
*
|
|
559
|
+
* COUNT(usuarios.iduser,"primero")
|
|
560
|
+
* //uso
|
|
561
|
+
* await DB.Select([COUNT(usuarios.iduser,"cantidad")]).from(usuarios()).execute();
|
|
562
|
+
* => [ { cantidad: 9 } ]
|
|
563
|
+
*/
|
|
564
|
+
declare const COUNT: (columna: string, pseudonombre?: string) => string;
|
|
565
|
+
/**
|
|
566
|
+
*
|
|
567
|
+
* @param {string} columna
|
|
568
|
+
* @param {string} pseudonombre
|
|
569
|
+
* @returns {string}
|
|
570
|
+
* @example
|
|
571
|
+
*
|
|
572
|
+
* MIN(usuarios.iduser,"primero")
|
|
573
|
+
* //uso
|
|
574
|
+
* await DB.Select([MIN(usuarios.iduser,"minimo")]).from(usuarios()).execute();
|
|
575
|
+
* => [ { minimo: 1 } ]
|
|
576
|
+
*/
|
|
577
|
+
declare const MIN: (columna: string, pseudonombre?: string) => string;
|
|
578
|
+
/**
|
|
579
|
+
*
|
|
580
|
+
* @param {string} columna
|
|
581
|
+
* @param {string} pseudonombre
|
|
582
|
+
* @returns {string}
|
|
583
|
+
* @example
|
|
584
|
+
*
|
|
585
|
+
* MAX(usuarios.iduser,"primero")
|
|
586
|
+
* //uso
|
|
587
|
+
* const [datos2] = await DB.Select([MAX(usuarios.iduser,"maximo")]).from(usuarios()).execute();
|
|
588
|
+
* => { maximo: 7 }
|
|
589
|
+
*/
|
|
590
|
+
declare const MAX: (columna: string, pseudonombre?: string) => string;
|
|
591
|
+
/**
|
|
592
|
+
*
|
|
593
|
+
* @param {string} columna
|
|
594
|
+
* @param {string} pseudonombre
|
|
595
|
+
* @returns {string}
|
|
596
|
+
* @example
|
|
597
|
+
*
|
|
598
|
+
* SUM(usuarios.iduser,"primero")
|
|
599
|
+
* //uso
|
|
600
|
+
* const [datos2] = await DB.Select([SUM(usuarios.iduser,"suma")]).from(usuarios()).execute();
|
|
601
|
+
* => { suma: 12 }
|
|
602
|
+
*/
|
|
603
|
+
declare const SUM: (columna: string, pseudonombre?: string) => string;
|
|
604
|
+
/**
|
|
605
|
+
*
|
|
606
|
+
* @param {roundInd} param
|
|
607
|
+
* @returns
|
|
608
|
+
* *
|
|
609
|
+
* ROUND(usuarios.dinero,2,"precioAlterado")
|
|
610
|
+
* //uso
|
|
611
|
+
* const [datos2] = await DB.Select([(usuarios.dinero,"precioalterado")]).from(usuarios()).execute();
|
|
612
|
+
* => { precioalterado: 12.22}
|
|
613
|
+
*/
|
|
614
|
+
declare const ROUND: ({ columna, decimales, pseudonombre }: roundInd) => string;
|
|
615
|
+
|
|
616
|
+
export { AND, ANDD, AVG, BDconnection, COUNT, CURRENT_TIMESTAMP, type Consultas, DB, DeleteR, ILIKE, MAX, MAYOR, MENOR, MIN, NOTNULL, NOW, NULL, OR, ORD, ORQ, ORQD, QueryBuilder, ROUND, SUM, Select, type TableProxy, type Tipos, UP, Update, type Valores, type arrayData, type arrayDatas, bool, type connecionLocal, type connecionRed, type connectionDB, defineTable, dropTable, eq, generateTable, getConexion, getRed, getTipoConexion, int, money, neq, timestamp, type valor, varchar };
|