@evs-chris/ts-pg-dao
Advanced tools
Comparing version
{ | ||
"name": "@evs-chris/ts-pg-dao", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"main": "runtime/main.js", | ||
@@ -5,0 +5,0 @@ "typings": "runtime/main.d.ts", |
@@ -191,2 +191,3 @@ import * as pg from 'pg'; | ||
length?: number; | ||
precision?: [number, number]; | ||
} | ||
@@ -193,0 +194,0 @@ export declare type TSType = 'Date' | 'number' | 'string' | 'any' | 'boolean' | 'Date[]' | 'number[]' | 'string[]' | 'any[]' | 'boolean[]' | 'any' | 'any[]'; |
@@ -291,3 +291,3 @@ "use strict"; | ||
const col = { | ||
name: r.name, nullable: r.nullable, pkey: r.pkey, pgtype: r.type, type: r.type[0] === '_' ? 'any[]' : 'any', elidable: false, length: r.length | ||
name: r.name, nullable: r.nullable, pkey: r.pkey, pgtype: r.type, type: r.type[0] === '_' ? 'any[]' : 'any', elidable: false, length: r.length, precision: r.precision | ||
}; | ||
@@ -294,0 +294,0 @@ if (~col.type.toLowerCase().indexOf('json')) |
@@ -345,2 +345,5 @@ "use strict"; | ||
tpl += `\n\n${reindent(model.codeMap.bothInner, ' ')}\n`; | ||
tpl += ` | ||
static lengths = { ${model.cols.filter(c => c.length).map(c => `${c.alias || c.name}: ${c.length}`).join(', ')} }; | ||
static precisions = { ${model.cols.filter(c => c.precision).map(c => `${c.alias || c.name}: ${JSON.stringify(c.precision)}`).join(', ')} }\n`; | ||
tpl += `}`; | ||
@@ -347,0 +350,0 @@ if (model.codeMap.clientOuter) |
92906
0.36%2003
0.2%