zormz 1.2.3 → 1.2.5
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 +107 -133
- package/dist/{index.d.cts → index.d.mts} +109 -28
- package/dist/index.d.ts +109 -28
- package/dist/index.js +362 -45
- package/dist/{index.cjs → index.mjs} +300 -101
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -1,14 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1
8
|
var __typeError = (msg) => {
|
|
2
9
|
throw TypeError(msg);
|
|
3
10
|
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
4
32
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
5
33
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
6
34
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
7
35
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
8
36
|
|
|
37
|
+
// index.ts
|
|
38
|
+
var index_exports = {};
|
|
39
|
+
__export(index_exports, {
|
|
40
|
+
AND: () => AND,
|
|
41
|
+
BDconnection: () => BDconnection,
|
|
42
|
+
CURRENT_TIMESTAMP: () => CURRENT_TIMESTAMP,
|
|
43
|
+
DB: () => DB,
|
|
44
|
+
DeleteR: () => DeleteR,
|
|
45
|
+
ILIKE: () => ILIKE,
|
|
46
|
+
MAYOR: () => MAYOR,
|
|
47
|
+
MENOR: () => MENOR,
|
|
48
|
+
NOTNULL: () => NOTNULL,
|
|
49
|
+
NOW: () => NOW,
|
|
50
|
+
NULL: () => NULL,
|
|
51
|
+
OR: () => OR,
|
|
52
|
+
ORQ: () => ORQ,
|
|
53
|
+
QueryBuilder: () => QueryBuilder,
|
|
54
|
+
Select: () => Select,
|
|
55
|
+
Update: () => Update,
|
|
56
|
+
bool: () => bool,
|
|
57
|
+
defineTable: () => defineTable,
|
|
58
|
+
eq: () => eq,
|
|
59
|
+
generateTable: () => generateTable,
|
|
60
|
+
getConexion: () => getConexion,
|
|
61
|
+
getRed: () => getRed,
|
|
62
|
+
getTipoConexion: () => getTipoConexion,
|
|
63
|
+
int: () => int,
|
|
64
|
+
money: () => money,
|
|
65
|
+
timestamp: () => timestamp,
|
|
66
|
+
varchar: () => varchar
|
|
67
|
+
});
|
|
68
|
+
module.exports = __toCommonJS(index_exports);
|
|
69
|
+
|
|
9
70
|
// conection/db.ts
|
|
10
71
|
var conexionZORMZ3691;
|
|
11
72
|
var tipoConexionZORMZ3691;
|
|
73
|
+
function getTipoConexion() {
|
|
74
|
+
return tipoConexionZORMZ3691;
|
|
75
|
+
}
|
|
12
76
|
var BDconnection = class {
|
|
13
77
|
constructor(bd, datos) {
|
|
14
78
|
this.tipo = "pg";
|
|
@@ -144,29 +208,6 @@ function defineTable(tableName, columns) {
|
|
|
144
208
|
});
|
|
145
209
|
return proxy;
|
|
146
210
|
}
|
|
147
|
-
function ValidacionTypos(columna, id, maxLength) {
|
|
148
|
-
let sql = "";
|
|
149
|
-
if (columna === "varchar")
|
|
150
|
-
sql += `VARCHAR(${maxLength ? maxLength : "100"})`;
|
|
151
|
-
if (columna === "int") {
|
|
152
|
-
if (tipoConexionZORMZ3691 === "pg") {
|
|
153
|
-
sql += id ? " " : " INTEGER ";
|
|
154
|
-
} else {
|
|
155
|
-
sql += " INT ";
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
if (columna === "bool")
|
|
159
|
-
sql += tipoConexionZORMZ3691 === "mysql" ? " TINYINT(1) " : " BOOLEAN ";
|
|
160
|
-
if (columna === "double")
|
|
161
|
-
sql += tipoConexionZORMZ3691 === "mysql" ? " DOUBLE " : " DOUBLE PRECISION ";
|
|
162
|
-
if (columna === "timestamp")
|
|
163
|
-
sql += tipoConexionZORMZ3691 === "mysql" ? " TIMESTAMP " : " TIMESTAMPTZ ";
|
|
164
|
-
if (columna === "float")
|
|
165
|
-
sql += tipoConexionZORMZ3691 === "mysql" ? " FLOAT " : " REAL";
|
|
166
|
-
if (columna === "money")
|
|
167
|
-
sql += tipoConexionZORMZ3691 === "mysql" ? " DECIMAL(10,2) " : " NUMERIC(10,2)";
|
|
168
|
-
return sql;
|
|
169
|
-
}
|
|
170
211
|
async function generateTable(tabla, columns) {
|
|
171
212
|
let queries = "";
|
|
172
213
|
let columnDefs = [];
|
|
@@ -178,17 +219,15 @@ async function generateTable(tabla, columns) {
|
|
|
178
219
|
if (!col.typo) {
|
|
179
220
|
throw new Error(`La columna ${columnName} no tiene el tipo definido`);
|
|
180
221
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
id
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
sql += col.unique === void 0 ? " NOT NULL " : " UNIQUE";
|
|
191
|
-
sql += col.default === void 0 ? col.unique === void 0 ? " " : " NOT NULL " : ` DEFAULT ${typeof col.default === "string" ? tipoConexionZORMZ3691 === "mysql" ? `"${col.default}"` : `'${col.default}'` : col.default}`;
|
|
222
|
+
if (col.typo === "int") {
|
|
223
|
+
let valorSql = col.sqlz.replace("$ZORMZ", columnName);
|
|
224
|
+
col.sqlz = valorSql;
|
|
225
|
+
}
|
|
226
|
+
if (id && col.pk === true) {
|
|
227
|
+
throw new Error("El id es unico por fila");
|
|
228
|
+
}
|
|
229
|
+
id = col.pk === true ? true : false;
|
|
230
|
+
sql += col.sqlz;
|
|
192
231
|
columnDefs.push(sql);
|
|
193
232
|
}
|
|
194
233
|
queries += `CREATE TABLE IF NOT EXISTS ${tabla} (
|
|
@@ -212,6 +251,185 @@ async function generateTable(tabla, columns) {
|
|
|
212
251
|
}
|
|
213
252
|
}
|
|
214
253
|
|
|
254
|
+
// conection/controls/int.ts
|
|
255
|
+
var IntColumn = class {
|
|
256
|
+
constructor() {
|
|
257
|
+
this.requerido = false;
|
|
258
|
+
this.unique = false;
|
|
259
|
+
this.autoIncrement = false;
|
|
260
|
+
this.unsingned = { uso: false, valor: 0 };
|
|
261
|
+
}
|
|
262
|
+
Required() {
|
|
263
|
+
this.requerido = true;
|
|
264
|
+
return this;
|
|
265
|
+
}
|
|
266
|
+
Pk() {
|
|
267
|
+
this.autoIncrement = true;
|
|
268
|
+
this.pk = true;
|
|
269
|
+
return this;
|
|
270
|
+
}
|
|
271
|
+
Unique() {
|
|
272
|
+
this.unique = true;
|
|
273
|
+
return this;
|
|
274
|
+
}
|
|
275
|
+
Unsingned(numeroPositivosInicio = 0) {
|
|
276
|
+
if (numeroPositivosInicio != void 0 && numeroPositivosInicio < 0) {
|
|
277
|
+
throw new Error(" Unsingned() solo permite numeros positivos ");
|
|
278
|
+
}
|
|
279
|
+
this.unsingned.uso = true;
|
|
280
|
+
this.unsingned.valor = numeroPositivosInicio;
|
|
281
|
+
}
|
|
282
|
+
AutoIncrement() {
|
|
283
|
+
this.autoIncrement = true;
|
|
284
|
+
this.requerido = true;
|
|
285
|
+
return this;
|
|
286
|
+
}
|
|
287
|
+
Default(value) {
|
|
288
|
+
this.defaultData = value;
|
|
289
|
+
return this;
|
|
290
|
+
}
|
|
291
|
+
withType({ defaultData, id = false, requerido, unique, autoIncrement }) {
|
|
292
|
+
if (defaultData !== void 0) this.Default(defaultData);
|
|
293
|
+
if (requerido) this.Required();
|
|
294
|
+
if (unique) this.Unique();
|
|
295
|
+
if (autoIncrement) this.AutoIncrement();
|
|
296
|
+
return this;
|
|
297
|
+
}
|
|
298
|
+
$() {
|
|
299
|
+
const parts = [];
|
|
300
|
+
const db = getTipoConexion();
|
|
301
|
+
parts.push(db === "mysql" ? "INT" : "INTEGER");
|
|
302
|
+
if (this.unsingned.uso) {
|
|
303
|
+
parts.push(
|
|
304
|
+
db === "mysql" ? "UNSIGNED" : ` CHECK ( $ZORMZ >= ${this.unsingned.valor}) `
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
parts.push(
|
|
308
|
+
this.requerido ? "NOT NULL" : db === "pg" && this.pk ? " " : "NULL"
|
|
309
|
+
);
|
|
310
|
+
if (this.autoIncrement) {
|
|
311
|
+
parts.push(
|
|
312
|
+
db === "pg" ? "GENERATED ALWAYS AS IDENTITY" : "AUTO_INCREMENT"
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
if (this.pk) {
|
|
316
|
+
parts.push("PRIMARY KEY");
|
|
317
|
+
const valor2 = {
|
|
318
|
+
pk: true,
|
|
319
|
+
typo: "int",
|
|
320
|
+
sqlz: parts.join(" ")
|
|
321
|
+
};
|
|
322
|
+
return valor2;
|
|
323
|
+
}
|
|
324
|
+
if (this.defaultData !== void 0 && !this.autoIncrement) {
|
|
325
|
+
parts.push(`DEFAULT ${this.defaultData}`);
|
|
326
|
+
}
|
|
327
|
+
if (this.unique) parts.push("UNIQUE");
|
|
328
|
+
const valor = {
|
|
329
|
+
pk: false,
|
|
330
|
+
typo: "int",
|
|
331
|
+
sqlz: parts.join(" ")
|
|
332
|
+
};
|
|
333
|
+
return valor;
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
function int() {
|
|
337
|
+
return new IntColumn();
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// conection/controls/timestamp.ts
|
|
341
|
+
var Timestamp = class {
|
|
342
|
+
constructor() {
|
|
343
|
+
this.requerido = false;
|
|
344
|
+
this.defaultNow = false;
|
|
345
|
+
this.onUpdateNow = false;
|
|
346
|
+
}
|
|
347
|
+
required() {
|
|
348
|
+
this.requerido = true;
|
|
349
|
+
return this;
|
|
350
|
+
}
|
|
351
|
+
now() {
|
|
352
|
+
this.defaultNow = true;
|
|
353
|
+
return this;
|
|
354
|
+
}
|
|
355
|
+
onUpdate() {
|
|
356
|
+
this.onUpdateNow = true;
|
|
357
|
+
return this;
|
|
358
|
+
}
|
|
359
|
+
$() {
|
|
360
|
+
const parts = [];
|
|
361
|
+
const db = getTipoConexion();
|
|
362
|
+
parts.push(db === "mysql" ? "TIMESTAMP" : "TIMESTAMPTZ");
|
|
363
|
+
parts.push(this.requerido ? "NOT NULL" : "NULL");
|
|
364
|
+
if (this.defaultNow) {
|
|
365
|
+
parts.push(`DEFAULT ${db === "mysql" ? "CURRENT_TIMESTAMP" : "NOW()"}`);
|
|
366
|
+
}
|
|
367
|
+
if (this.onUpdateNow && db === "mysql") {
|
|
368
|
+
parts.push("ON UPDATE CURRENT_TIMESTAMP");
|
|
369
|
+
}
|
|
370
|
+
const response = {
|
|
371
|
+
typo: "timestamp",
|
|
372
|
+
pk: false,
|
|
373
|
+
sqlz: parts.join(" ")
|
|
374
|
+
};
|
|
375
|
+
return response;
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
function timestamp() {
|
|
379
|
+
return new Timestamp();
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// conection/controls/varchar.ts
|
|
383
|
+
var Varchar = class {
|
|
384
|
+
constructor(cantidad = 100) {
|
|
385
|
+
this.maxLenth = 100;
|
|
386
|
+
this.defaultData = "";
|
|
387
|
+
this.requerido = false;
|
|
388
|
+
this.unique = false;
|
|
389
|
+
this.maxLenth = cantidad;
|
|
390
|
+
}
|
|
391
|
+
withType({
|
|
392
|
+
maxLenth = 100,
|
|
393
|
+
defaultData = "",
|
|
394
|
+
requerido = false,
|
|
395
|
+
unique = false
|
|
396
|
+
}) {
|
|
397
|
+
this.maxLenth = maxLenth;
|
|
398
|
+
this.requerido = requerido;
|
|
399
|
+
this.unique = unique;
|
|
400
|
+
return this.Default(defaultData).$();
|
|
401
|
+
}
|
|
402
|
+
Required() {
|
|
403
|
+
this.requerido = true;
|
|
404
|
+
return this;
|
|
405
|
+
}
|
|
406
|
+
Unique() {
|
|
407
|
+
this.unique = true;
|
|
408
|
+
return this;
|
|
409
|
+
}
|
|
410
|
+
Default(textoDefecto) {
|
|
411
|
+
let opcion = getTipoConexion();
|
|
412
|
+
if (opcion === "mysql") {
|
|
413
|
+
this.defaultData = ` "${textoDefecto}" `;
|
|
414
|
+
} else if (opcion === "pg") {
|
|
415
|
+
this.defaultData = ` '${textoDefecto}' `;
|
|
416
|
+
}
|
|
417
|
+
return this;
|
|
418
|
+
}
|
|
419
|
+
$() {
|
|
420
|
+
let sqlz = `VARCHAR(${this.maxLenth}) ${this.requerido ? "NOT NULL" : "NULL"} ${this.defaultData.length > 0 ? ` DEFAULT ${this.defaultData} ` : " "} ${this.unique ? " UNIQUE" : " "} `;
|
|
421
|
+
const response = {
|
|
422
|
+
typo: "varchar",
|
|
423
|
+
pk: false,
|
|
424
|
+
sqlz
|
|
425
|
+
};
|
|
426
|
+
return response;
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
function varchar(cantidad = 100) {
|
|
430
|
+
return new Varchar(cantidad);
|
|
431
|
+
}
|
|
432
|
+
|
|
215
433
|
// conection/middleware/delete.ts
|
|
216
434
|
var _condicion, _tabla;
|
|
217
435
|
var DeleteR = class {
|
|
@@ -221,12 +439,12 @@ var DeleteR = class {
|
|
|
221
439
|
* @example
|
|
222
440
|
* delete from tabla
|
|
223
441
|
*/
|
|
224
|
-
constructor(
|
|
442
|
+
constructor(conexion2, tabla) {
|
|
225
443
|
__privateAdd(this, _condicion);
|
|
226
444
|
__privateAdd(this, _tabla);
|
|
227
445
|
__privateSet(this, _tabla, tabla);
|
|
228
446
|
__privateSet(this, _condicion, "");
|
|
229
|
-
this.conexion =
|
|
447
|
+
this.conexion = conexion2;
|
|
230
448
|
}
|
|
231
449
|
/**
|
|
232
450
|
*
|
|
@@ -272,7 +490,7 @@ var QueryBuilder = class {
|
|
|
272
490
|
* @param {string} tabla - nombre de la ta tabla - campo obligatorio
|
|
273
491
|
* @param {string[]} values - campo obligatorio
|
|
274
492
|
*/
|
|
275
|
-
constructor(
|
|
493
|
+
constructor(conexion2, tabla, parametros) {
|
|
276
494
|
if (!parametros || !Array.isArray(parametros)) {
|
|
277
495
|
throw new Error(`campos obligatorios`);
|
|
278
496
|
}
|
|
@@ -283,7 +501,7 @@ var QueryBuilder = class {
|
|
|
283
501
|
this.parametros = parametros;
|
|
284
502
|
this.valores = [];
|
|
285
503
|
this.valorRetorno = null;
|
|
286
|
-
this.conexion =
|
|
504
|
+
this.conexion = conexion2;
|
|
287
505
|
}
|
|
288
506
|
/**
|
|
289
507
|
*
|
|
@@ -383,8 +601,8 @@ var Select = class {
|
|
|
383
601
|
* @param {string[]} values - campo obligatorio
|
|
384
602
|
* @param {string} condition - tabla1.id = tabla2.idtabla1 - id='2' - id='2' AND id='3'
|
|
385
603
|
*/
|
|
386
|
-
constructor(
|
|
387
|
-
this.conexion =
|
|
604
|
+
constructor(conexion2, parametros = "*") {
|
|
605
|
+
this.conexion = conexion2;
|
|
388
606
|
this.valores = !Array.isArray(parametros) ? false : true;
|
|
389
607
|
this.parametros = parametros;
|
|
390
608
|
this.tabla = void 0;
|
|
@@ -568,7 +786,7 @@ var Update = class {
|
|
|
568
786
|
/**
|
|
569
787
|
* @param {string} nombreTabla - nombre de la tabla a actualizar
|
|
570
788
|
*/
|
|
571
|
-
constructor(
|
|
789
|
+
constructor(conexion2, nombreTabla) {
|
|
572
790
|
this.nombreTabla = "";
|
|
573
791
|
this.valores = "";
|
|
574
792
|
this.condicion = "";
|
|
@@ -579,7 +797,7 @@ var Update = class {
|
|
|
579
797
|
throw new Error("El nombre de la tabla es requerido");
|
|
580
798
|
}
|
|
581
799
|
this.nombreTabla = nombreTabla;
|
|
582
|
-
this.conexion =
|
|
800
|
+
this.conexion = conexion2;
|
|
583
801
|
}
|
|
584
802
|
/**
|
|
585
803
|
* @param {Valores} valores - valores a actualizar
|
|
@@ -676,7 +894,100 @@ var DB = class {
|
|
|
676
894
|
return new DeleteR(conex, nombreTabla);
|
|
677
895
|
}
|
|
678
896
|
};
|
|
679
|
-
|
|
897
|
+
|
|
898
|
+
// conection/controls/bool.ts
|
|
899
|
+
var BoolColumn = class {
|
|
900
|
+
constructor() {
|
|
901
|
+
this.requerido = false;
|
|
902
|
+
}
|
|
903
|
+
required() {
|
|
904
|
+
this.requerido = true;
|
|
905
|
+
return this;
|
|
906
|
+
}
|
|
907
|
+
default(value) {
|
|
908
|
+
this.defaultData = value;
|
|
909
|
+
return this;
|
|
910
|
+
}
|
|
911
|
+
$() {
|
|
912
|
+
const parts = [];
|
|
913
|
+
const db = getTipoConexion();
|
|
914
|
+
parts.push("BOOLEAN");
|
|
915
|
+
parts.push(this.requerido ? "NOT NULL" : "NULL");
|
|
916
|
+
if (this.defaultData !== void 0) {
|
|
917
|
+
parts.push(
|
|
918
|
+
`DEFAULT ${db === "mysql" ? this.defaultData ? 1 : 0 : this.defaultData}`
|
|
919
|
+
);
|
|
920
|
+
}
|
|
921
|
+
const response = {
|
|
922
|
+
typo: "bool",
|
|
923
|
+
pk: false,
|
|
924
|
+
sqlz: parts.join(" ")
|
|
925
|
+
};
|
|
926
|
+
return response;
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
function bool() {
|
|
930
|
+
return new BoolColumn();
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
// conection/controls/money.ts
|
|
934
|
+
var Money = class {
|
|
935
|
+
constructor(presicion = 10, decimales = 2) {
|
|
936
|
+
this.precision = 10;
|
|
937
|
+
this.scale = 2;
|
|
938
|
+
this.requerido = false;
|
|
939
|
+
this.precision = presicion;
|
|
940
|
+
this.scale = decimales;
|
|
941
|
+
}
|
|
942
|
+
required() {
|
|
943
|
+
this.requerido = true;
|
|
944
|
+
return this;
|
|
945
|
+
}
|
|
946
|
+
default(value) {
|
|
947
|
+
this.defaultData = value;
|
|
948
|
+
return this;
|
|
949
|
+
}
|
|
950
|
+
$() {
|
|
951
|
+
const parts = [];
|
|
952
|
+
const db = getTipoConexion();
|
|
953
|
+
parts.push(
|
|
954
|
+
db === "mysql" ? `DECIMAL(${this.precision},${this.scale})` : `NUMERIC(${this.precision},${this.scale})`
|
|
955
|
+
);
|
|
956
|
+
parts.push(this.requerido ? "NOT NULL" : "NULL");
|
|
957
|
+
if (this.defaultData !== void 0) {
|
|
958
|
+
parts.push(`DEFAULT ${this.defaultData.toFixed(this.scale)}`);
|
|
959
|
+
}
|
|
960
|
+
const response = {
|
|
961
|
+
typo: "money",
|
|
962
|
+
pk: false,
|
|
963
|
+
sqlz: parts.join(" ")
|
|
964
|
+
};
|
|
965
|
+
return response;
|
|
966
|
+
}
|
|
967
|
+
};
|
|
968
|
+
function money(presicion = 10, decimales = 2) {
|
|
969
|
+
return new Money(presicion, decimales);
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
// index.ts
|
|
973
|
+
var conexion = {
|
|
974
|
+
database: "pruebamaster",
|
|
975
|
+
host: "localhost",
|
|
976
|
+
password: "zainmaster123",
|
|
977
|
+
port: 5432,
|
|
978
|
+
user: "postgres"
|
|
979
|
+
};
|
|
980
|
+
getConexion("pg", conexion);
|
|
981
|
+
var prueba1 = defineTable("prueba1", {
|
|
982
|
+
id: int().Pk().$(),
|
|
983
|
+
valor: varchar(200).Default("hola").$(),
|
|
984
|
+
resultado: int().Default(0).$(),
|
|
985
|
+
fechaRegistro: timestamp().required().now().$(),
|
|
986
|
+
fechaUpdate: timestamp().required().now().onUpdate().$()
|
|
987
|
+
});
|
|
988
|
+
generateTable(prueba1(), prueba1.$columns);
|
|
989
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
990
|
+
0 && (module.exports = {
|
|
680
991
|
AND,
|
|
681
992
|
BDconnection,
|
|
682
993
|
CURRENT_TIMESTAMP,
|
|
@@ -693,9 +1004,15 @@ export {
|
|
|
693
1004
|
QueryBuilder,
|
|
694
1005
|
Select,
|
|
695
1006
|
Update,
|
|
1007
|
+
bool,
|
|
696
1008
|
defineTable,
|
|
697
1009
|
eq,
|
|
698
1010
|
generateTable,
|
|
699
1011
|
getConexion,
|
|
700
|
-
getRed
|
|
701
|
-
|
|
1012
|
+
getRed,
|
|
1013
|
+
getTipoConexion,
|
|
1014
|
+
int,
|
|
1015
|
+
money,
|
|
1016
|
+
timestamp,
|
|
1017
|
+
varchar
|
|
1018
|
+
});
|