multi-db-orm 2.1.15 → 2.1.17

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.
@@ -15,7 +15,18 @@ export class MultiDbORM {
15
15
 
16
16
  getdb(): any;
17
17
 
18
- get(modelname: string, filter: Record<string, any>): Promise<any>;
18
+ get(modelname: string, filter?: Record<string, any>, options?: {
19
+ apply?: {
20
+ field: string,
21
+ sort: string,
22
+ ineq: {
23
+ op: '>=' | '<=' | '=' | '>' | '<',
24
+ value: string | number | boolean
25
+ }
26
+ },
27
+ sort?: { field: string, order: 'asc' | 'desc' }[]
28
+ limit?: number, offset: number
29
+ }): Promise<any>;
19
30
 
20
31
  getOne(modelname: string, filter: Record<string, any>): Promise<any>;
21
32
 
@@ -23,7 +34,7 @@ export class MultiDbORM {
23
34
 
24
35
  insert(modelname: string, object: Record<string, any>): Promise<any>;
25
36
 
26
- update(modelname: string, filter: Record<string, any>, object: Record<string, any>): Promise<any>;
37
+ update(modelname: string, filter?: Record<string, any>, object: Record<string, any>): Promise<any>;
27
38
 
28
- delete(modelname: string, filter: Record<string, any>): Promise<any>;
39
+ delete(modelname: string, filter?: Record<string, any>): Promise<any>;
29
40
  }
@@ -184,10 +184,10 @@ class MySQLDB extends MultiDbORM {
184
184
  }
185
185
  for (var key in object) {
186
186
  let val = object[key]
187
- if (typeof val == 'object')
188
- val = vals + `${key} = '${JSON.stringify(object[key])}',`
189
187
  if ( val == "undefined" || val == undefined || val == 'null'|| val == null)
190
188
  vals = vals + `${key} = Null,`;
189
+ else if (typeof val == 'object')
190
+ val = vals + `${key} = '${JSON.stringify(object[key])}',`
191
191
  else if (typeof val == 'boolean')
192
192
  vals = vals + `${key} = ${val},`;
193
193
  else
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multi-db-orm",
3
- "version": "2.1.15",
3
+ "version": "2.1.17",
4
4
  "description": "CRUD , Backup , Restore and Migration library for multiple databases",
5
5
  "main": "index.js",
6
6
  "dependencies": {