remult 0.14.13 → 0.14.14

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.
File without changes
@@ -0,0 +1,2 @@
1
+ import { FieldMetadata } from '../src/column-interfaces';
2
+ export declare function postgresColumnSyntax(x: FieldMetadata, dbName: string): string;
@@ -0,0 +1,30 @@
1
+ import { ValueConverters } from '../valueConverters';
2
+ export function postgresColumnSyntax(x, dbName) {
3
+ let result = dbName;
4
+ if (x.valueType == Number) {
5
+ if (!x.valueConverter.fieldTypeInDb)
6
+ result += " numeric" + (x.allowNull ? "" : " default 0 not null");
7
+ else
8
+ result += " " + x.valueConverter.fieldTypeInDb + (x.allowNull ? "" : " default 0 not null");
9
+ }
10
+ else if (x.valueType == Date) {
11
+ if (!x.valueConverter.fieldTypeInDb)
12
+ if (x.valueConverter == ValueConverters.DateOnly)
13
+ result += " date";
14
+ else
15
+ result += " timestamp";
16
+ else
17
+ result += " " + x.valueConverter.fieldTypeInDb;
18
+ }
19
+ else if (x.valueType == Boolean)
20
+ result += " boolean" + (x.allowNull ? "" : " default false not null");
21
+ else if (x.valueConverter.fieldTypeInDb) {
22
+ result += " " + x.valueConverter.fieldTypeInDb;
23
+ if (!x.allowNull && x.valueConverter.fieldTypeInDb == 'integer') {
24
+ result += " default 0 not null";
25
+ }
26
+ }
27
+ else
28
+ result += " varchar" + (x.allowNull ? "" : " default '' not null");
29
+ return result;
30
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "0.14.13",
3
+ "version": "0.14.14",
4
4
  "description": "A CRUD framework for full-stack TypeScript",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",