zormz 1.4.1 → 1.4.3
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 +218 -74
- package/dist/index.d.mts +47 -18
- package/dist/index.d.ts +47 -18
- package/dist/index.js +108 -17
- package/dist/index.mjs +107 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,17 +7,17 @@ Permite conectarse a una base de datos, definir tablas desde TypeScript con auto
|
|
|
7
7
|
|
|
8
8
|
## Características
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
- Compatible con **ESM** y **CommonJS**
|
|
11
|
+
- Tipado completo en **TypeScript**
|
|
12
|
+
- Builder con sintaxis encadenada: `select().from().where().execute()`
|
|
13
|
+
- Insert múltiple con arrays
|
|
14
|
+
- Update y Delete con condiciones
|
|
15
|
+
- Definición de columnas con encadenamiento:
|
|
16
|
+
- `int().Pk().$()`
|
|
17
|
+
- `varchar(200).Default("hola").$()`
|
|
18
|
+
- Generación automática de tablas en MySQL y PostgreSQL
|
|
19
|
+
- Sin dependencias pesadas
|
|
20
|
+
- Fácil de extender
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
@@ -29,20 +29,43 @@ npm install zormz
|
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
## Uso basico
|
|
32
|
-
### importacion ESM
|
|
33
|
-
```ts
|
|
34
32
|
|
|
35
|
-
|
|
33
|
+
### importacion ESM
|
|
36
34
|
|
|
35
|
+
```ts
|
|
36
|
+
import {
|
|
37
|
+
connecionLocal,
|
|
38
|
+
getConexion,
|
|
39
|
+
defineTable,
|
|
40
|
+
generateTable,
|
|
41
|
+
int,
|
|
42
|
+
varchar,
|
|
43
|
+
DB,
|
|
44
|
+
eq,
|
|
45
|
+
ORQ,
|
|
46
|
+
} from "zormz";
|
|
37
47
|
```
|
|
48
|
+
|
|
38
49
|
### importacion COMMONJS
|
|
39
50
|
|
|
40
51
|
```ts
|
|
41
|
-
const {
|
|
42
|
-
|
|
52
|
+
const {
|
|
53
|
+
connecionLocal,
|
|
54
|
+
getConexion,
|
|
55
|
+
defineTable,
|
|
56
|
+
generateTable,
|
|
57
|
+
int,
|
|
58
|
+
varchar,
|
|
59
|
+
DB,
|
|
60
|
+
eq,
|
|
61
|
+
ORQ,
|
|
62
|
+
} = require("zormz");
|
|
43
63
|
```
|
|
64
|
+
|
|
44
65
|
## Conexion a la base de datos
|
|
66
|
+
|
|
45
67
|
### MYSQL
|
|
68
|
+
|
|
46
69
|
```ts
|
|
47
70
|
const conexionMysql: connecionLocal = {
|
|
48
71
|
database: "pruebas",
|
|
@@ -53,15 +76,15 @@ const conexionMysql: connecionLocal = {
|
|
|
53
76
|
};
|
|
54
77
|
|
|
55
78
|
getConexion("mysql", conexionMysql);
|
|
56
|
-
|
|
57
79
|
```
|
|
58
80
|
|
|
59
81
|
### PG
|
|
82
|
+
|
|
60
83
|
```ts
|
|
61
84
|
//Conexion por red , aqui solo se pone la ruta que por defecto te arroja la base de datos de la nube
|
|
62
|
-
const conexion2:connecionRed = {
|
|
63
|
-
|
|
64
|
-
}
|
|
85
|
+
const conexion2: connecionRed = {
|
|
86
|
+
connectionString: "direccion",
|
|
87
|
+
};
|
|
65
88
|
|
|
66
89
|
const conexion: connecionLocal = {
|
|
67
90
|
database: "pruebamaster",
|
|
@@ -72,10 +95,9 @@ const conexion: connecionLocal = {
|
|
|
72
95
|
};
|
|
73
96
|
|
|
74
97
|
getConexion("pg", conexion);
|
|
75
|
-
|
|
76
98
|
```
|
|
77
99
|
|
|
78
|
-
## Definicion de Tablas
|
|
100
|
+
## Definicion de Tablas
|
|
79
101
|
|
|
80
102
|
```ts
|
|
81
103
|
export const prueba1 = defineTable("prueba1", {
|
|
@@ -83,11 +105,12 @@ export const prueba1 = defineTable("prueba1", {
|
|
|
83
105
|
valor: varchar(200).Default("hola").$(),
|
|
84
106
|
resultado: int().Default(0).$(),
|
|
85
107
|
fechaRegistro: timestamp().required().now().$(),
|
|
86
|
-
fechaUpdate: timestamp().required().now().onUpdate().$()
|
|
108
|
+
fechaUpdate: timestamp().required().now().onUpdate().$(),
|
|
87
109
|
});
|
|
88
|
-
|
|
89
110
|
```
|
|
111
|
+
|
|
90
112
|
o
|
|
113
|
+
|
|
91
114
|
```ts
|
|
92
115
|
export function generateTables() {
|
|
93
116
|
return {
|
|
@@ -98,7 +121,7 @@ export function generateTables() {
|
|
|
98
121
|
dni: varchar(9).$(),
|
|
99
122
|
rol: varchar(50).$(),
|
|
100
123
|
diastrabajo: varchar(200).Default("sabado - domingo").$(),
|
|
101
|
-
|
|
124
|
+
estado: varchar().Check(["pendiente", "completado", "rechazado"]).$(),
|
|
102
125
|
}),
|
|
103
126
|
permisos: defineTable("permisos", {
|
|
104
127
|
idpermiso: int().Pk().$(),
|
|
@@ -116,21 +139,27 @@ export function generateTables() {
|
|
|
116
139
|
```
|
|
117
140
|
|
|
118
141
|
### Notas importantes
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
142
|
+
|
|
143
|
+
- **.pk()** define la columna como clave primaria
|
|
144
|
+
- **.Default()** entrega un valor por defecto
|
|
145
|
+
- **.$()** finaliza la definicion y entrega un valor compatible con _$columns_
|
|
146
|
+
- **.required()** Indica que los valores de la fila no podran ser null, si o si un valor obligatorio
|
|
147
|
+
- **.now()** Solo esta disponible para timestamp , indica fecha automatica de registra
|
|
148
|
+
- **.onUpdate()** Tomara la fecha actual cada ves que se haga un update
|
|
149
|
+
- **.Check()** Solo para varchar , puedes decirle que valores esta obligado a recibir y no otros
|
|
150
|
+
|
|
125
151
|
## Generacion de tablas
|
|
152
|
+
|
|
126
153
|
```ts
|
|
127
|
-
generateTable(prueba1(), prueba1.$columns)
|
|
154
|
+
generateTable(prueba1(), prueba1.$columns,true);//true para ver la definicion
|
|
128
155
|
```
|
|
156
|
+
|
|
129
157
|
Esto crea la tabla en la base de datos respetando tipos, claves primarias y valores por defecto.
|
|
130
158
|
|
|
131
159
|
---
|
|
132
160
|
|
|
133
161
|
## Eliminar tablas
|
|
162
|
+
|
|
134
163
|
```ts
|
|
135
164
|
await dropTable(prueba4());
|
|
136
165
|
```
|
|
@@ -139,10 +168,14 @@ await dropTable(prueba4());
|
|
|
139
168
|
|
|
140
169
|
```ts
|
|
141
170
|
await DB.Insert(prueba1(), [prueba1.valor, prueba1.resultado])
|
|
142
|
-
.Values([
|
|
171
|
+
.Values([
|
|
172
|
+
["hola mundo", 1],
|
|
173
|
+
["prueba", 0],
|
|
174
|
+
])
|
|
175
|
+
.Returning(prueba1.id)
|
|
143
176
|
.execute();
|
|
144
|
-
|
|
145
177
|
```
|
|
178
|
+
|
|
146
179
|
---
|
|
147
180
|
|
|
148
181
|
## Select de Datos
|
|
@@ -151,67 +184,175 @@ await DB.Insert(prueba1(), [prueba1.valor, prueba1.resultado])
|
|
|
151
184
|
const datos = await DB.select()
|
|
152
185
|
.from(prueba1())
|
|
153
186
|
.where(eq(prueba1.id, 1))
|
|
154
|
-
.execute();
|
|
155
|
-
|
|
187
|
+
.execute(true);
|
|
156
188
|
```
|
|
189
|
+
|
|
157
190
|
---
|
|
158
191
|
|
|
159
192
|
## Update de Datos
|
|
160
|
-
|
|
193
|
+
|
|
194
|
+
### .set() Recibe un objeto con clave valor de las tablas o un array con UP
|
|
195
|
+
|
|
161
196
|
```ts
|
|
162
197
|
await DB.Update(prueba1())
|
|
163
198
|
.set({ valor: "nuevo valor", resultado: 2 })
|
|
164
199
|
.where(eq(prueba1.id, 1))
|
|
165
200
|
.execute();
|
|
166
|
-
|
|
167
201
|
```
|
|
202
|
+
|
|
168
203
|
o
|
|
204
|
+
|
|
169
205
|
```ts
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
206
|
+
//Usar la funcion UP
|
|
207
|
+
const response = await DB.Update(producto())
|
|
208
|
+
.set([UP(producto.stockactual, `${producto.stockactual} - 4`, true)])
|
|
209
|
+
.where(eq(producto.idproducto, 4))
|
|
210
|
+
.execute();
|
|
176
211
|
```
|
|
177
212
|
|
|
178
213
|
---
|
|
214
|
+
|
|
179
215
|
## Delete de Datos
|
|
216
|
+
|
|
180
217
|
```ts
|
|
181
218
|
await DB.Delete(prueba1())
|
|
182
219
|
.where(ORQ(prueba1.id, 2, 3))
|
|
183
220
|
.execute();
|
|
184
|
-
|
|
185
221
|
```
|
|
222
|
+
|
|
186
223
|
## JOINS
|
|
224
|
+
|
|
187
225
|
```ts
|
|
188
226
|
const { detallespermisos, colaborador, permisos } = generateTables();
|
|
189
227
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
228
|
+
const response = await DB.Select([
|
|
229
|
+
detallespermisos.iddetallepermiso,
|
|
230
|
+
colaborador.nombrecompleto,
|
|
231
|
+
colaborador.dni,
|
|
232
|
+
permisos.nombre,
|
|
233
|
+
permisos.estado,
|
|
234
|
+
])
|
|
235
|
+
.from(detallespermisos())
|
|
236
|
+
.innerJOIN(
|
|
237
|
+
colaborador(),
|
|
238
|
+
eq(colaborador.idcolaborador, detallespermisos.idcolaborador, false),
|
|
239
|
+
)
|
|
240
|
+
.innerJOIN(
|
|
241
|
+
permisos(),
|
|
242
|
+
eq(permisos.idpermiso, detallespermisos.idppermiso, false),
|
|
243
|
+
)
|
|
244
|
+
.execute();
|
|
245
|
+
```
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Operadores y Helpers SQL
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
### eq(valor1,valor2,literal = true)
|
|
252
|
+
comparacion de igualdad
|
|
253
|
+
|
|
254
|
+
```ts
|
|
255
|
+
eq("dni", dni);//2do valor como variable
|
|
256
|
+
eq("id","idLaptops",true)//2do valor como campo de tabla
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### neq(valor1,valor2,literal = true)
|
|
260
|
+
comparacion de negacion
|
|
261
|
+
|
|
262
|
+
```ts
|
|
263
|
+
neq("dni", dni);//2do valor como variable
|
|
264
|
+
neq("id","idLaptops",true)//2do valor como campo de tabla
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
### AND(...condiciones)
|
|
270
|
+
Agrupa múltiples condiciones con `AND`.
|
|
271
|
+
|
|
272
|
+
```ts
|
|
273
|
+
AND(eq(), eq(), neq())
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### OR(...condiciones)
|
|
277
|
+
Agrupa múltiples condiciones con `OR`.
|
|
278
|
+
|
|
279
|
+
```ts
|
|
280
|
+
OR(neq(), eq(), eq())
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### ORQ(campo,...valores)
|
|
284
|
+
Genera multiples comparaciones `OR` para un mismo campo.
|
|
285
|
+
|
|
286
|
+
```ts
|
|
287
|
+
ORQ("id",1,2,3);
|
|
288
|
+
// => id = 1 or id = 2 or id = 3
|
|
289
|
+
```
|
|
290
|
+
---
|
|
291
|
+
### ILIKE(campo,valor)
|
|
292
|
+
Comparacion insensible a mayusculas/minusculas
|
|
293
|
+
|
|
294
|
+
```ts
|
|
295
|
+
ILIKE('nombre','%juan%');
|
|
296
|
+
// => nombre ILIKE '%juan%'
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### NOW(campo,dias,minor = true)
|
|
300
|
+
Compara una fecha con la fecha actual menos X días.
|
|
301
|
+
```ts
|
|
302
|
+
NOW('fecha_creacion', 7)
|
|
303
|
+
// => ( fecha_creacion < NOW() - INTERVAL '7 days')
|
|
304
|
+
|
|
305
|
+
NOW('fecha_creacion', 7, false)
|
|
306
|
+
// => ( fecha_creacion > NOW() - INTERVAL '7 days')
|
|
307
|
+
|
|
308
|
+
```
|
|
309
|
+
---
|
|
310
|
+
### NULL(campo)
|
|
311
|
+
valida si un campo es NULL
|
|
312
|
+
```ts
|
|
313
|
+
NULL('delete_at');
|
|
314
|
+
//=> delete_at IS NULL
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### NOTNULL(campo)
|
|
318
|
+
valida si un campo no es NULL
|
|
319
|
+
```ts
|
|
320
|
+
NOTNULL('deleted_at')
|
|
321
|
+
// => deleted_at IS NOT NULL
|
|
322
|
+
```
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
### MAYOR(campo,valor)
|
|
327
|
+
Comparacion mayor que (`>`)
|
|
328
|
+
```ts
|
|
329
|
+
|
|
330
|
+
MAYOR('edad',18);
|
|
331
|
+
// => edad > 18
|
|
332
|
+
```
|
|
333
|
+
### MENOR(campo,valor)
|
|
334
|
+
Comparacion menor que (`<`)
|
|
335
|
+
```ts
|
|
336
|
+
MENOR('edad', 18)
|
|
337
|
+
// => edad < 18
|
|
207
338
|
|
|
208
339
|
```
|
|
209
340
|
---
|
|
210
341
|
|
|
211
|
-
## Ejemplo de Uso
|
|
342
|
+
## Ejemplo de Uso
|
|
212
343
|
|
|
213
344
|
```ts
|
|
214
|
-
import {
|
|
345
|
+
import {
|
|
346
|
+
connecionLocal,
|
|
347
|
+
getConexion,
|
|
348
|
+
defineTable,
|
|
349
|
+
generateTable,
|
|
350
|
+
int,
|
|
351
|
+
varchar,
|
|
352
|
+
DB,
|
|
353
|
+
eq,
|
|
354
|
+
ORQ,
|
|
355
|
+
} from "zormz";
|
|
215
356
|
|
|
216
357
|
const conexion: connecionLocal = {
|
|
217
358
|
database: "pruebamaster",
|
|
@@ -228,14 +369,17 @@ getConexion("pg", conexion);
|
|
|
228
369
|
const prueba1 = defineTable("prueba1", {
|
|
229
370
|
id: int().Pk().$(),
|
|
230
371
|
valor: varchar(200).Default("hola").$(),
|
|
231
|
-
resultado: int().Default(0).$()
|
|
372
|
+
resultado: int().Default(0).$(),
|
|
232
373
|
});
|
|
233
374
|
|
|
234
375
|
generateTable(prueba1(), prueba1.$columns);
|
|
235
376
|
|
|
236
377
|
async function pruebaData() {
|
|
237
378
|
await DB.Insert(prueba1(), [prueba1.valor, prueba1.resultado])
|
|
238
|
-
.Values([
|
|
379
|
+
.Values([
|
|
380
|
+
["hola mundo", 1],
|
|
381
|
+
["prueba", 0],
|
|
382
|
+
])
|
|
239
383
|
.execute();
|
|
240
384
|
|
|
241
385
|
const datos = await DB.select().from(prueba1()).execute();
|
|
@@ -252,19 +396,19 @@ async function pruebaData() {
|
|
|
252
396
|
}
|
|
253
397
|
|
|
254
398
|
pruebaData().catch(console.error);
|
|
255
|
-
|
|
256
399
|
```
|
|
257
400
|
|
|
258
401
|
---
|
|
259
|
-
|
|
260
402
|
## Notas
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
403
|
+
|
|
404
|
+
- ORM en version inicial con enfoque de tipado y autompletado
|
|
405
|
+
- Compatible con **MYSQL** y **PG**
|
|
406
|
+
- Preparado para extenderse
|
|
407
|
+
- Las versiones +1.3.0 son mas estables , las anteriores estaban en desarrollo y presentan multiples errores
|
|
408
|
+
- version estable 1.4.2
|
|
409
|
+
|
|
266
410
|
## Licencia
|
|
267
411
|
|
|
268
412
|
ISC © Yukio-kayaba
|
|
269
413
|
|
|
270
|
-
[](https://github.com/yukio-kayaba/)
|
|
414
|
+
[](https://github.com/yukio-kayaba/)
|
package/dist/index.d.mts
CHANGED
|
@@ -12,6 +12,7 @@ interface ColumnDefinition<T extends ColumnTypes = ColumnTypes> {
|
|
|
12
12
|
typo: T;
|
|
13
13
|
pk?: boolean;
|
|
14
14
|
sqlz: string;
|
|
15
|
+
check?: string
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
interface VarcharType{
|
|
@@ -83,25 +84,17 @@ type TableProxy<TCols> = {
|
|
|
83
84
|
* @param {string} tableName
|
|
84
85
|
* @param {string} columns
|
|
85
86
|
* @example
|
|
86
|
-
* export const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
edad: {
|
|
94
|
-
typo:"int",
|
|
95
|
-
default: 0,
|
|
96
|
-
},
|
|
97
|
-
apellido : {
|
|
98
|
-
typo:"varchar",
|
|
99
|
-
}
|
|
87
|
+
* export const categorias = defineTable("categorias", {
|
|
88
|
+
idcategoria: int().Pk().$(),
|
|
89
|
+
nombrecategoria: varchar(100).Check(['disponible','data']).Required().$(),
|
|
90
|
+
descripcion: varchar(250).$(),
|
|
91
|
+
estado: bool().default(true).$(),
|
|
92
|
+
})
|
|
100
93
|
* });
|
|
101
94
|
* @returns
|
|
102
95
|
*/
|
|
103
96
|
declare function defineTable<T extends Record<string, ColumnDefinition>>(tableName: string, columns: T): TableProxy<T>;
|
|
104
|
-
declare function generateTable<T extends Record<string, ColumnDefinition>>(tabla: string, columns: T): Promise<void>;
|
|
97
|
+
declare function generateTable<T extends Record<string, ColumnDefinition>>(tabla: string, columns: T, seeSQL?: boolean): Promise<void>;
|
|
105
98
|
declare function dropTable(nombreTabla: string): Promise<void>;
|
|
106
99
|
|
|
107
100
|
declare class DeleteR {
|
|
@@ -131,7 +124,7 @@ declare class QueryBuilder {
|
|
|
131
124
|
private tabla;
|
|
132
125
|
private parametros;
|
|
133
126
|
private valores;
|
|
134
|
-
private
|
|
127
|
+
private returning;
|
|
135
128
|
private conexion;
|
|
136
129
|
/**
|
|
137
130
|
* @throws {Error} Si la consulta es vacía.
|
|
@@ -154,7 +147,8 @@ declare class QueryBuilder {
|
|
|
154
147
|
* @returns
|
|
155
148
|
*/
|
|
156
149
|
Values(values: arrayData | arrayDatas): this;
|
|
157
|
-
|
|
150
|
+
Returning(idRetorno: string): this;
|
|
151
|
+
execute(see?: boolean): Promise<any[] | undefined>;
|
|
158
152
|
}
|
|
159
153
|
|
|
160
154
|
type valor = "ASC" | "DESC";
|
|
@@ -344,6 +338,19 @@ declare const NOTNULL: (variable: string) => string;
|
|
|
344
338
|
* eq('id',valor1, false)
|
|
345
339
|
*/
|
|
346
340
|
declare const eq: (valor1: Valor, valor2: Valor, literal?: boolean) => string;
|
|
341
|
+
/**
|
|
342
|
+
*
|
|
343
|
+
* @param {(string | number | boolean )} valor1 - primer valor
|
|
344
|
+
* @param {(string | number | boolean )} valor2 - segundo valor
|
|
345
|
+
* @param {(boolean )} literal
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* //en caso sea un valores normalres
|
|
349
|
+
* neq('id','1')
|
|
350
|
+
* //en caso de que seaq un valor de tabla columna
|
|
351
|
+
* neq('id',valor1, false)
|
|
352
|
+
*/
|
|
353
|
+
declare const neq: (valor1: Valor, valor2: Valor, literal?: boolean) => string;
|
|
347
354
|
/**
|
|
348
355
|
*
|
|
349
356
|
* @param {string} valor
|
|
@@ -392,9 +399,11 @@ declare class IntColumn {
|
|
|
392
399
|
private defaultData?;
|
|
393
400
|
private pk?;
|
|
394
401
|
private unsingned;
|
|
402
|
+
private comentario;
|
|
395
403
|
constructor();
|
|
396
404
|
Required(): this;
|
|
397
405
|
Pk(): this;
|
|
406
|
+
Comment(comentario: string): this;
|
|
398
407
|
Unique(): this;
|
|
399
408
|
Unsingned(numeroPositivosInicio?: number): this;
|
|
400
409
|
AutoIncrement(): this;
|
|
@@ -409,9 +418,23 @@ declare class Varchar {
|
|
|
409
418
|
private defaultData;
|
|
410
419
|
private requerido;
|
|
411
420
|
private unique;
|
|
421
|
+
private enum;
|
|
422
|
+
private campo;
|
|
423
|
+
private comentarios;
|
|
412
424
|
constructor(cantidad?: number);
|
|
413
425
|
withType({ maxLenth, defaultData, requerido, unique, }: VarcharType): ColumnDefinition<ColumnTypes>;
|
|
426
|
+
/**
|
|
427
|
+
*
|
|
428
|
+
* @param {string} campo
|
|
429
|
+
* @param {string[]} datos
|
|
430
|
+
* @example
|
|
431
|
+
* Check("example", ["operativo","denegado","revisando"])
|
|
432
|
+
*
|
|
433
|
+
* @returns
|
|
434
|
+
*/
|
|
435
|
+
Check(datos: (string)[]): this;
|
|
414
436
|
Required(): this;
|
|
437
|
+
Comment(comentario: string): this;
|
|
415
438
|
Unique(): this;
|
|
416
439
|
Default(textoDefecto: string): this;
|
|
417
440
|
$(): ColumnDefinition<ColumnTypes>;
|
|
@@ -421,7 +444,9 @@ declare function varchar(cantidad?: number): Varchar;
|
|
|
421
444
|
declare class BoolColumn {
|
|
422
445
|
private requerido;
|
|
423
446
|
private defaultData?;
|
|
447
|
+
private comentario;
|
|
424
448
|
required(): this;
|
|
449
|
+
Comment(comentario: string): this;
|
|
425
450
|
default(value: boolean): this;
|
|
426
451
|
$(): ColumnDefinition;
|
|
427
452
|
}
|
|
@@ -431,7 +456,9 @@ declare class Timestamp {
|
|
|
431
456
|
private requerido;
|
|
432
457
|
private defaultNow;
|
|
433
458
|
private onUpdateNow;
|
|
459
|
+
private comentario;
|
|
434
460
|
required(): this;
|
|
461
|
+
comment(comentario: string): this;
|
|
435
462
|
now(): this;
|
|
436
463
|
onUpdate(): this;
|
|
437
464
|
$(): ColumnDefinition<ColumnTypes>;
|
|
@@ -443,11 +470,13 @@ declare class Money {
|
|
|
443
470
|
private scale;
|
|
444
471
|
private requerido;
|
|
445
472
|
private defaultData?;
|
|
473
|
+
private comentario;
|
|
446
474
|
constructor(presicion?: number, decimales?: number);
|
|
447
475
|
required(): this;
|
|
448
476
|
default(value: number): this;
|
|
477
|
+
comment(comentario: string): this;
|
|
449
478
|
$(): ColumnDefinition<ColumnTypes>;
|
|
450
479
|
}
|
|
451
480
|
declare function money(presicion?: number, decimales?: number): Money;
|
|
452
481
|
|
|
453
|
-
export { AND, BDconnection, CURRENT_TIMESTAMP, type Consultas, DB, DeleteR, ILIKE, MAYOR, MENOR, NOTNULL, NOW, NULL, OR, ORQ, QueryBuilder, 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, timestamp, type valor, varchar };
|
|
482
|
+
export { AND, BDconnection, CURRENT_TIMESTAMP, type Consultas, DB, DeleteR, ILIKE, MAYOR, MENOR, NOTNULL, NOW, NULL, OR, ORQ, QueryBuilder, 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 };
|