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
|
@@ -1,69 +1,17 @@
|
|
|
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;
|
|
8
1
|
var __typeError = (msg) => {
|
|
9
2
|
throw TypeError(msg);
|
|
10
3
|
};
|
|
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);
|
|
32
4
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
33
5
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
34
6
|
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);
|
|
35
7
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
36
8
|
|
|
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
|
-
defineTable: () => defineTable,
|
|
57
|
-
eq: () => eq,
|
|
58
|
-
generateTable: () => generateTable,
|
|
59
|
-
getConexion: () => getConexion,
|
|
60
|
-
getRed: () => getRed
|
|
61
|
-
});
|
|
62
|
-
module.exports = __toCommonJS(index_exports);
|
|
63
|
-
|
|
64
9
|
// conection/db.ts
|
|
65
10
|
var conexionZORMZ3691;
|
|
66
11
|
var tipoConexionZORMZ3691;
|
|
12
|
+
function getTipoConexion() {
|
|
13
|
+
return tipoConexionZORMZ3691;
|
|
14
|
+
}
|
|
67
15
|
var BDconnection = class {
|
|
68
16
|
constructor(bd, datos) {
|
|
69
17
|
this.tipo = "pg";
|
|
@@ -199,29 +147,6 @@ function defineTable(tableName, columns) {
|
|
|
199
147
|
});
|
|
200
148
|
return proxy;
|
|
201
149
|
}
|
|
202
|
-
function ValidacionTypos(columna, id, maxLength) {
|
|
203
|
-
let sql = "";
|
|
204
|
-
if (columna === "varchar")
|
|
205
|
-
sql += `VARCHAR(${maxLength ? maxLength : "100"})`;
|
|
206
|
-
if (columna === "int") {
|
|
207
|
-
if (tipoConexionZORMZ3691 === "pg") {
|
|
208
|
-
sql += id ? " " : " INTEGER ";
|
|
209
|
-
} else {
|
|
210
|
-
sql += " INT ";
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
if (columna === "bool")
|
|
214
|
-
sql += tipoConexionZORMZ3691 === "mysql" ? " TINYINT(1) " : " BOOLEAN ";
|
|
215
|
-
if (columna === "double")
|
|
216
|
-
sql += tipoConexionZORMZ3691 === "mysql" ? " DOUBLE " : " DOUBLE PRECISION ";
|
|
217
|
-
if (columna === "timestamp")
|
|
218
|
-
sql += tipoConexionZORMZ3691 === "mysql" ? " TIMESTAMP " : " TIMESTAMPTZ ";
|
|
219
|
-
if (columna === "float")
|
|
220
|
-
sql += tipoConexionZORMZ3691 === "mysql" ? " FLOAT " : " REAL";
|
|
221
|
-
if (columna === "money")
|
|
222
|
-
sql += tipoConexionZORMZ3691 === "mysql" ? " DECIMAL(10,2) " : " NUMERIC(10,2)";
|
|
223
|
-
return sql;
|
|
224
|
-
}
|
|
225
150
|
async function generateTable(tabla, columns) {
|
|
226
151
|
let queries = "";
|
|
227
152
|
let columnDefs = [];
|
|
@@ -233,17 +158,15 @@ async function generateTable(tabla, columns) {
|
|
|
233
158
|
if (!col.typo) {
|
|
234
159
|
throw new Error(`La columna ${columnName} no tiene el tipo definido`);
|
|
235
160
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
id
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
sql += col.unique === void 0 ? " NOT NULL " : " UNIQUE";
|
|
246
|
-
sql += col.default === void 0 ? col.unique === void 0 ? " " : " NOT NULL " : ` DEFAULT ${typeof col.default === "string" ? tipoConexionZORMZ3691 === "mysql" ? `"${col.default}"` : `'${col.default}'` : col.default}`;
|
|
161
|
+
if (col.typo === "int") {
|
|
162
|
+
let valorSql = col.sqlz.replace("$ZORMZ", columnName);
|
|
163
|
+
col.sqlz = valorSql;
|
|
164
|
+
}
|
|
165
|
+
if (id && col.pk === true) {
|
|
166
|
+
throw new Error("El id es unico por fila");
|
|
167
|
+
}
|
|
168
|
+
id = col.pk === true ? true : false;
|
|
169
|
+
sql += col.sqlz;
|
|
247
170
|
columnDefs.push(sql);
|
|
248
171
|
}
|
|
249
172
|
queries += `CREATE TABLE IF NOT EXISTS ${tabla} (
|
|
@@ -267,6 +190,185 @@ async function generateTable(tabla, columns) {
|
|
|
267
190
|
}
|
|
268
191
|
}
|
|
269
192
|
|
|
193
|
+
// conection/controls/int.ts
|
|
194
|
+
var IntColumn = class {
|
|
195
|
+
constructor() {
|
|
196
|
+
this.requerido = false;
|
|
197
|
+
this.unique = false;
|
|
198
|
+
this.autoIncrement = false;
|
|
199
|
+
this.unsingned = { uso: false, valor: 0 };
|
|
200
|
+
}
|
|
201
|
+
Required() {
|
|
202
|
+
this.requerido = true;
|
|
203
|
+
return this;
|
|
204
|
+
}
|
|
205
|
+
Pk() {
|
|
206
|
+
this.autoIncrement = true;
|
|
207
|
+
this.pk = true;
|
|
208
|
+
return this;
|
|
209
|
+
}
|
|
210
|
+
Unique() {
|
|
211
|
+
this.unique = true;
|
|
212
|
+
return this;
|
|
213
|
+
}
|
|
214
|
+
Unsingned(numeroPositivosInicio = 0) {
|
|
215
|
+
if (numeroPositivosInicio != void 0 && numeroPositivosInicio < 0) {
|
|
216
|
+
throw new Error(" Unsingned() solo permite numeros positivos ");
|
|
217
|
+
}
|
|
218
|
+
this.unsingned.uso = true;
|
|
219
|
+
this.unsingned.valor = numeroPositivosInicio;
|
|
220
|
+
}
|
|
221
|
+
AutoIncrement() {
|
|
222
|
+
this.autoIncrement = true;
|
|
223
|
+
this.requerido = true;
|
|
224
|
+
return this;
|
|
225
|
+
}
|
|
226
|
+
Default(value) {
|
|
227
|
+
this.defaultData = value;
|
|
228
|
+
return this;
|
|
229
|
+
}
|
|
230
|
+
withType({ defaultData, id = false, requerido, unique, autoIncrement }) {
|
|
231
|
+
if (defaultData !== void 0) this.Default(defaultData);
|
|
232
|
+
if (requerido) this.Required();
|
|
233
|
+
if (unique) this.Unique();
|
|
234
|
+
if (autoIncrement) this.AutoIncrement();
|
|
235
|
+
return this;
|
|
236
|
+
}
|
|
237
|
+
$() {
|
|
238
|
+
const parts = [];
|
|
239
|
+
const db = getTipoConexion();
|
|
240
|
+
parts.push(db === "mysql" ? "INT" : "INTEGER");
|
|
241
|
+
if (this.unsingned.uso) {
|
|
242
|
+
parts.push(
|
|
243
|
+
db === "mysql" ? "UNSIGNED" : ` CHECK ( $ZORMZ >= ${this.unsingned.valor}) `
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
parts.push(
|
|
247
|
+
this.requerido ? "NOT NULL" : db === "pg" && this.pk ? " " : "NULL"
|
|
248
|
+
);
|
|
249
|
+
if (this.autoIncrement) {
|
|
250
|
+
parts.push(
|
|
251
|
+
db === "pg" ? "GENERATED ALWAYS AS IDENTITY" : "AUTO_INCREMENT"
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
if (this.pk) {
|
|
255
|
+
parts.push("PRIMARY KEY");
|
|
256
|
+
const valor2 = {
|
|
257
|
+
pk: true,
|
|
258
|
+
typo: "int",
|
|
259
|
+
sqlz: parts.join(" ")
|
|
260
|
+
};
|
|
261
|
+
return valor2;
|
|
262
|
+
}
|
|
263
|
+
if (this.defaultData !== void 0 && !this.autoIncrement) {
|
|
264
|
+
parts.push(`DEFAULT ${this.defaultData}`);
|
|
265
|
+
}
|
|
266
|
+
if (this.unique) parts.push("UNIQUE");
|
|
267
|
+
const valor = {
|
|
268
|
+
pk: false,
|
|
269
|
+
typo: "int",
|
|
270
|
+
sqlz: parts.join(" ")
|
|
271
|
+
};
|
|
272
|
+
return valor;
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
function int() {
|
|
276
|
+
return new IntColumn();
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// conection/controls/timestamp.ts
|
|
280
|
+
var Timestamp = class {
|
|
281
|
+
constructor() {
|
|
282
|
+
this.requerido = false;
|
|
283
|
+
this.defaultNow = false;
|
|
284
|
+
this.onUpdateNow = false;
|
|
285
|
+
}
|
|
286
|
+
required() {
|
|
287
|
+
this.requerido = true;
|
|
288
|
+
return this;
|
|
289
|
+
}
|
|
290
|
+
now() {
|
|
291
|
+
this.defaultNow = true;
|
|
292
|
+
return this;
|
|
293
|
+
}
|
|
294
|
+
onUpdate() {
|
|
295
|
+
this.onUpdateNow = true;
|
|
296
|
+
return this;
|
|
297
|
+
}
|
|
298
|
+
$() {
|
|
299
|
+
const parts = [];
|
|
300
|
+
const db = getTipoConexion();
|
|
301
|
+
parts.push(db === "mysql" ? "TIMESTAMP" : "TIMESTAMPTZ");
|
|
302
|
+
parts.push(this.requerido ? "NOT NULL" : "NULL");
|
|
303
|
+
if (this.defaultNow) {
|
|
304
|
+
parts.push(`DEFAULT ${db === "mysql" ? "CURRENT_TIMESTAMP" : "NOW()"}`);
|
|
305
|
+
}
|
|
306
|
+
if (this.onUpdateNow && db === "mysql") {
|
|
307
|
+
parts.push("ON UPDATE CURRENT_TIMESTAMP");
|
|
308
|
+
}
|
|
309
|
+
const response = {
|
|
310
|
+
typo: "timestamp",
|
|
311
|
+
pk: false,
|
|
312
|
+
sqlz: parts.join(" ")
|
|
313
|
+
};
|
|
314
|
+
return response;
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
function timestamp() {
|
|
318
|
+
return new Timestamp();
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// conection/controls/varchar.ts
|
|
322
|
+
var Varchar = class {
|
|
323
|
+
constructor(cantidad = 100) {
|
|
324
|
+
this.maxLenth = 100;
|
|
325
|
+
this.defaultData = "";
|
|
326
|
+
this.requerido = false;
|
|
327
|
+
this.unique = false;
|
|
328
|
+
this.maxLenth = cantidad;
|
|
329
|
+
}
|
|
330
|
+
withType({
|
|
331
|
+
maxLenth = 100,
|
|
332
|
+
defaultData = "",
|
|
333
|
+
requerido = false,
|
|
334
|
+
unique = false
|
|
335
|
+
}) {
|
|
336
|
+
this.maxLenth = maxLenth;
|
|
337
|
+
this.requerido = requerido;
|
|
338
|
+
this.unique = unique;
|
|
339
|
+
return this.Default(defaultData).$();
|
|
340
|
+
}
|
|
341
|
+
Required() {
|
|
342
|
+
this.requerido = true;
|
|
343
|
+
return this;
|
|
344
|
+
}
|
|
345
|
+
Unique() {
|
|
346
|
+
this.unique = true;
|
|
347
|
+
return this;
|
|
348
|
+
}
|
|
349
|
+
Default(textoDefecto) {
|
|
350
|
+
let opcion = getTipoConexion();
|
|
351
|
+
if (opcion === "mysql") {
|
|
352
|
+
this.defaultData = ` "${textoDefecto}" `;
|
|
353
|
+
} else if (opcion === "pg") {
|
|
354
|
+
this.defaultData = ` '${textoDefecto}' `;
|
|
355
|
+
}
|
|
356
|
+
return this;
|
|
357
|
+
}
|
|
358
|
+
$() {
|
|
359
|
+
let sqlz = `VARCHAR(${this.maxLenth}) ${this.requerido ? "NOT NULL" : "NULL"} ${this.defaultData.length > 0 ? ` DEFAULT ${this.defaultData} ` : " "} ${this.unique ? " UNIQUE" : " "} `;
|
|
360
|
+
const response = {
|
|
361
|
+
typo: "varchar",
|
|
362
|
+
pk: false,
|
|
363
|
+
sqlz
|
|
364
|
+
};
|
|
365
|
+
return response;
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
function varchar(cantidad = 100) {
|
|
369
|
+
return new Varchar(cantidad);
|
|
370
|
+
}
|
|
371
|
+
|
|
270
372
|
// conection/middleware/delete.ts
|
|
271
373
|
var _condicion, _tabla;
|
|
272
374
|
var DeleteR = class {
|
|
@@ -276,12 +378,12 @@ var DeleteR = class {
|
|
|
276
378
|
* @example
|
|
277
379
|
* delete from tabla
|
|
278
380
|
*/
|
|
279
|
-
constructor(
|
|
381
|
+
constructor(conexion2, tabla) {
|
|
280
382
|
__privateAdd(this, _condicion);
|
|
281
383
|
__privateAdd(this, _tabla);
|
|
282
384
|
__privateSet(this, _tabla, tabla);
|
|
283
385
|
__privateSet(this, _condicion, "");
|
|
284
|
-
this.conexion =
|
|
386
|
+
this.conexion = conexion2;
|
|
285
387
|
}
|
|
286
388
|
/**
|
|
287
389
|
*
|
|
@@ -327,7 +429,7 @@ var QueryBuilder = class {
|
|
|
327
429
|
* @param {string} tabla - nombre de la ta tabla - campo obligatorio
|
|
328
430
|
* @param {string[]} values - campo obligatorio
|
|
329
431
|
*/
|
|
330
|
-
constructor(
|
|
432
|
+
constructor(conexion2, tabla, parametros) {
|
|
331
433
|
if (!parametros || !Array.isArray(parametros)) {
|
|
332
434
|
throw new Error(`campos obligatorios`);
|
|
333
435
|
}
|
|
@@ -338,7 +440,7 @@ var QueryBuilder = class {
|
|
|
338
440
|
this.parametros = parametros;
|
|
339
441
|
this.valores = [];
|
|
340
442
|
this.valorRetorno = null;
|
|
341
|
-
this.conexion =
|
|
443
|
+
this.conexion = conexion2;
|
|
342
444
|
}
|
|
343
445
|
/**
|
|
344
446
|
*
|
|
@@ -438,8 +540,8 @@ var Select = class {
|
|
|
438
540
|
* @param {string[]} values - campo obligatorio
|
|
439
541
|
* @param {string} condition - tabla1.id = tabla2.idtabla1 - id='2' - id='2' AND id='3'
|
|
440
542
|
*/
|
|
441
|
-
constructor(
|
|
442
|
-
this.conexion =
|
|
543
|
+
constructor(conexion2, parametros = "*") {
|
|
544
|
+
this.conexion = conexion2;
|
|
443
545
|
this.valores = !Array.isArray(parametros) ? false : true;
|
|
444
546
|
this.parametros = parametros;
|
|
445
547
|
this.tabla = void 0;
|
|
@@ -623,7 +725,7 @@ var Update = class {
|
|
|
623
725
|
/**
|
|
624
726
|
* @param {string} nombreTabla - nombre de la tabla a actualizar
|
|
625
727
|
*/
|
|
626
|
-
constructor(
|
|
728
|
+
constructor(conexion2, nombreTabla) {
|
|
627
729
|
this.nombreTabla = "";
|
|
628
730
|
this.valores = "";
|
|
629
731
|
this.condicion = "";
|
|
@@ -634,7 +736,7 @@ var Update = class {
|
|
|
634
736
|
throw new Error("El nombre de la tabla es requerido");
|
|
635
737
|
}
|
|
636
738
|
this.nombreTabla = nombreTabla;
|
|
637
|
-
this.conexion =
|
|
739
|
+
this.conexion = conexion2;
|
|
638
740
|
}
|
|
639
741
|
/**
|
|
640
742
|
* @param {Valores} valores - valores a actualizar
|
|
@@ -731,8 +833,99 @@ var DB = class {
|
|
|
731
833
|
return new DeleteR(conex, nombreTabla);
|
|
732
834
|
}
|
|
733
835
|
};
|
|
734
|
-
|
|
735
|
-
|
|
836
|
+
|
|
837
|
+
// conection/controls/bool.ts
|
|
838
|
+
var BoolColumn = class {
|
|
839
|
+
constructor() {
|
|
840
|
+
this.requerido = false;
|
|
841
|
+
}
|
|
842
|
+
required() {
|
|
843
|
+
this.requerido = true;
|
|
844
|
+
return this;
|
|
845
|
+
}
|
|
846
|
+
default(value) {
|
|
847
|
+
this.defaultData = value;
|
|
848
|
+
return this;
|
|
849
|
+
}
|
|
850
|
+
$() {
|
|
851
|
+
const parts = [];
|
|
852
|
+
const db = getTipoConexion();
|
|
853
|
+
parts.push("BOOLEAN");
|
|
854
|
+
parts.push(this.requerido ? "NOT NULL" : "NULL");
|
|
855
|
+
if (this.defaultData !== void 0) {
|
|
856
|
+
parts.push(
|
|
857
|
+
`DEFAULT ${db === "mysql" ? this.defaultData ? 1 : 0 : this.defaultData}`
|
|
858
|
+
);
|
|
859
|
+
}
|
|
860
|
+
const response = {
|
|
861
|
+
typo: "bool",
|
|
862
|
+
pk: false,
|
|
863
|
+
sqlz: parts.join(" ")
|
|
864
|
+
};
|
|
865
|
+
return response;
|
|
866
|
+
}
|
|
867
|
+
};
|
|
868
|
+
function bool() {
|
|
869
|
+
return new BoolColumn();
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
// conection/controls/money.ts
|
|
873
|
+
var Money = class {
|
|
874
|
+
constructor(presicion = 10, decimales = 2) {
|
|
875
|
+
this.precision = 10;
|
|
876
|
+
this.scale = 2;
|
|
877
|
+
this.requerido = false;
|
|
878
|
+
this.precision = presicion;
|
|
879
|
+
this.scale = decimales;
|
|
880
|
+
}
|
|
881
|
+
required() {
|
|
882
|
+
this.requerido = true;
|
|
883
|
+
return this;
|
|
884
|
+
}
|
|
885
|
+
default(value) {
|
|
886
|
+
this.defaultData = value;
|
|
887
|
+
return this;
|
|
888
|
+
}
|
|
889
|
+
$() {
|
|
890
|
+
const parts = [];
|
|
891
|
+
const db = getTipoConexion();
|
|
892
|
+
parts.push(
|
|
893
|
+
db === "mysql" ? `DECIMAL(${this.precision},${this.scale})` : `NUMERIC(${this.precision},${this.scale})`
|
|
894
|
+
);
|
|
895
|
+
parts.push(this.requerido ? "NOT NULL" : "NULL");
|
|
896
|
+
if (this.defaultData !== void 0) {
|
|
897
|
+
parts.push(`DEFAULT ${this.defaultData.toFixed(this.scale)}`);
|
|
898
|
+
}
|
|
899
|
+
const response = {
|
|
900
|
+
typo: "money",
|
|
901
|
+
pk: false,
|
|
902
|
+
sqlz: parts.join(" ")
|
|
903
|
+
};
|
|
904
|
+
return response;
|
|
905
|
+
}
|
|
906
|
+
};
|
|
907
|
+
function money(presicion = 10, decimales = 2) {
|
|
908
|
+
return new Money(presicion, decimales);
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
// index.ts
|
|
912
|
+
var conexion = {
|
|
913
|
+
database: "pruebamaster",
|
|
914
|
+
host: "localhost",
|
|
915
|
+
password: "zainmaster123",
|
|
916
|
+
port: 5432,
|
|
917
|
+
user: "postgres"
|
|
918
|
+
};
|
|
919
|
+
getConexion("pg", conexion);
|
|
920
|
+
var prueba1 = defineTable("prueba1", {
|
|
921
|
+
id: int().Pk().$(),
|
|
922
|
+
valor: varchar(200).Default("hola").$(),
|
|
923
|
+
resultado: int().Default(0).$(),
|
|
924
|
+
fechaRegistro: timestamp().required().now().$(),
|
|
925
|
+
fechaUpdate: timestamp().required().now().onUpdate().$()
|
|
926
|
+
});
|
|
927
|
+
generateTable(prueba1(), prueba1.$columns);
|
|
928
|
+
export {
|
|
736
929
|
AND,
|
|
737
930
|
BDconnection,
|
|
738
931
|
CURRENT_TIMESTAMP,
|
|
@@ -749,9 +942,15 @@ var DB = class {
|
|
|
749
942
|
QueryBuilder,
|
|
750
943
|
Select,
|
|
751
944
|
Update,
|
|
945
|
+
bool,
|
|
752
946
|
defineTable,
|
|
753
947
|
eq,
|
|
754
948
|
generateTable,
|
|
755
949
|
getConexion,
|
|
756
|
-
getRed
|
|
757
|
-
|
|
950
|
+
getRed,
|
|
951
|
+
getTipoConexion,
|
|
952
|
+
int,
|
|
953
|
+
money,
|
|
954
|
+
timestamp,
|
|
955
|
+
varchar
|
|
956
|
+
};
|
package/package.json
CHANGED