merge master
This commit is contained in:
commit
1e81065b30
@ -1,6 +1,5 @@
|
||||
# typeorm-model-generator
|
||||
|
||||
[![Greenkeeper badge](https://badges.greenkeeper.io/Kononnable/typeorm-model-generator.svg)](https://greenkeeper.io/)
|
||||
[![Build Status](https://travis-ci.org/Kononnable/typeorm-model-generator.svg?branch=master)](https://travis-ci.org/Kononnable/typeorm-model-generator)
|
||||
[![npm version](https://badge.fury.io/js/typeorm-model-generator.svg)](https://badge.fury.io/js/typeorm-model-generator)
|
||||
[![codecov](https://codecov.io/gh/Kononnable/typeorm-model-generator/branch/master/graph/badge.svg)](https://codecov.io/gh/Kononnable/typeorm-model-generator)
|
||||
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -2959,9 +2959,9 @@
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.11",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
|
||||
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
|
||||
"version": "4.17.14",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.14.tgz",
|
||||
"integrity": "sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw=="
|
||||
},
|
||||
"lodash.flattendeep": {
|
||||
"version": "4.4.0",
|
||||
|
@ -72,6 +72,9 @@ export class MysqlDriver extends AbstractDriver {
|
||||
resp.COLUMN_DEFAULT
|
||||
);
|
||||
colInfo.options.type = resp.DATA_TYPE as any;
|
||||
colInfo.options.unsigned = resp.COLUMN_TYPE.endsWith(
|
||||
" unsigned"
|
||||
);
|
||||
switch (resp.DATA_TYPE) {
|
||||
case "int":
|
||||
colInfo.tsType = "number";
|
||||
@ -163,7 +166,7 @@ export class MysqlDriver extends AbstractDriver {
|
||||
).replace(/\'/gi, '"');
|
||||
break;
|
||||
case "json":
|
||||
colInfo.tsType = "Object";
|
||||
colInfo.tsType = "object";
|
||||
break;
|
||||
case "binary":
|
||||
colInfo.tsType = "Buffer";
|
||||
|
@ -159,8 +159,8 @@ export class PostgresDriver extends AbstractDriver {
|
||||
| "boolean"
|
||||
| "Date"
|
||||
| "Buffer"
|
||||
| "Object"
|
||||
| "string | Object"
|
||||
| "object"
|
||||
| "string | object"
|
||||
| "string | string[]"
|
||||
| "any"
|
||||
| null;
|
||||
@ -288,7 +288,7 @@ export class PostgresDriver extends AbstractDriver {
|
||||
ret.ts_type = "string";
|
||||
break;
|
||||
case "point":
|
||||
ret.ts_type = "string | Object";
|
||||
ret.ts_type = "string | object";
|
||||
break;
|
||||
case "line":
|
||||
ret.ts_type = "string";
|
||||
@ -297,7 +297,7 @@ export class PostgresDriver extends AbstractDriver {
|
||||
ret.ts_type = "string | string[]";
|
||||
break;
|
||||
case "box":
|
||||
ret.ts_type = "string | Object";
|
||||
ret.ts_type = "string | object";
|
||||
break;
|
||||
case "path":
|
||||
ret.ts_type = "string";
|
||||
@ -306,7 +306,7 @@ export class PostgresDriver extends AbstractDriver {
|
||||
ret.ts_type = "string";
|
||||
break;
|
||||
case "circle":
|
||||
ret.ts_type = "string | Object";
|
||||
ret.ts_type = "string | object";
|
||||
break;
|
||||
case "cidr":
|
||||
ret.ts_type = "string";
|
||||
@ -330,10 +330,10 @@ export class PostgresDriver extends AbstractDriver {
|
||||
ret.ts_type = "string";
|
||||
break;
|
||||
case "json":
|
||||
ret.ts_type = "Object";
|
||||
ret.ts_type = "object";
|
||||
break;
|
||||
case "jsonb":
|
||||
ret.ts_type = "Object";
|
||||
ret.ts_type = "object";
|
||||
break;
|
||||
case "int4range":
|
||||
ret.ts_type = "string";
|
||||
|
@ -15,7 +15,8 @@ import {BaseEntity,Column,Entity,Index,JoinColumn,JoinTable,ManyToMany,ManyToOne
|
||||
primary:{{primary}},{{/primary}}{{/generated}}{{#unique}}
|
||||
unique: true,{{/unique}}{{#length}}
|
||||
length:{{.}},{{/length}}{{#width}}
|
||||
width:{{.}},{{/width}}{{#default}}
|
||||
width:{{.}},{{/width}}{{#unsigned}}
|
||||
unsigned: true,{{/unsigned}}{{#default}}
|
||||
default: {{.}},{{/default}}{{#precision}}
|
||||
precision:{{.}},{{/precision}}{{#scale}}
|
||||
scale:{{.}},{{/scale}}{{#enum}}
|
||||
@ -32,8 +33,8 @@ import {BaseEntity,Column,Entity,Index,JoinColumn,JoinTable,ManyToMany,ManyToOne
|
||||
{{/if}}
|
||||
{{#if relationIdField }}
|
||||
|
||||
@RelationId(({{toPropertyName ../../tsEntityName}}: {{toEntityName ../../tsEntityName}}) => {{toPropertyName ../../tsEntityName}}.{{toPropertyName ../tsName}})
|
||||
{{toPropertyName ../tsName}}Id: {{#if isOneToOne}}{{toLazy ../tsType}}{{else}}{{toLazy (concat ../tsType "[]")}}{{/if}};{{/if}}{{/relations}}
|
||||
@RelationId(({{toPropertyName ../../tsEntityName}}: {{toEntityName ../../tsEntityName}}) => {{toEntityName ../../tsEntityName}}.{{toPropertyName ../tsName}})
|
||||
{{printPropertyVisibility}}{{toPropertyName ../tsName}}Id: {{#if isOneToOne}}{{toLazy ../tsType}}{{else}}{{toLazy (concat ../tsType "[]")}}{{/if}};{{/if}}{{/relations}}
|
||||
{{/Columns}}
|
||||
{{#if GenerateConstructor}}
|
||||
constructor(init?: Partial<{{toEntityName tsEntityName}}>) {
|
||||
|
@ -10,8 +10,8 @@ export class ColumnInfo {
|
||||
| "boolean"
|
||||
| "Date"
|
||||
| "Buffer"
|
||||
| "Object"
|
||||
| "string | Object"
|
||||
| "object"
|
||||
| "string | object"
|
||||
| "string | string[]"
|
||||
| "any";
|
||||
public relations: RelationInfo[] = [];
|
||||
|
@ -89,7 +89,7 @@ export class Post {
|
||||
|
||||
// In mariaDb Json is recognized as longtext
|
||||
// @Column("json")
|
||||
// json: Object;
|
||||
// json: object;
|
||||
|
||||
@Column("binary")
|
||||
binary: Buffer;
|
||||
|
@ -15,10 +15,13 @@ export class Post {
|
||||
@Column("int")
|
||||
int: number;
|
||||
|
||||
@Column("int", { unsigned: true })
|
||||
uint: number;
|
||||
|
||||
@Column("tinyint")
|
||||
tinyint: number;
|
||||
|
||||
@Column("tinyint",{width:1})
|
||||
@Column("tinyint", { width: 1 })
|
||||
boolean: boolean;
|
||||
|
||||
@Column("smallint")
|
||||
@ -88,7 +91,7 @@ export class Post {
|
||||
enum: string;
|
||||
|
||||
@Column("json")
|
||||
json: Object;
|
||||
json: object;
|
||||
|
||||
@Column("binary")
|
||||
binary: Buffer;
|
||||
|
@ -123,7 +123,7 @@ export class Post {
|
||||
// enum: string;
|
||||
|
||||
@Column("point")
|
||||
point: string | Object;
|
||||
point: string | object;
|
||||
|
||||
@Column("line")
|
||||
line: string;
|
||||
@ -132,7 +132,7 @@ export class Post {
|
||||
lseg: string | string[];
|
||||
|
||||
@Column("box")
|
||||
box: string | Object;
|
||||
box: string | object;
|
||||
|
||||
@Column("path")
|
||||
path: string;
|
||||
@ -141,7 +141,7 @@ export class Post {
|
||||
polygon: string;
|
||||
|
||||
@Column("circle")
|
||||
circle: string | Object;
|
||||
circle: string | object;
|
||||
|
||||
@Column("cidr")
|
||||
cidr: string;
|
||||
@ -165,10 +165,10 @@ export class Post {
|
||||
xml: string;
|
||||
|
||||
@Column("json")
|
||||
json: Object;
|
||||
json: object;
|
||||
|
||||
@Column("jsonb")
|
||||
jsonb: Object;
|
||||
jsonb: object;
|
||||
|
||||
@Column("int4range")
|
||||
int4range: string;
|
||||
|
@ -123,7 +123,7 @@ export class PostArrays {
|
||||
// enum: string[];
|
||||
|
||||
@Column("point", { array: true })
|
||||
point: string[] | Object[];
|
||||
point: string[] | object[];
|
||||
|
||||
@Column("line", { array: true })
|
||||
line: string[];
|
||||
@ -132,7 +132,7 @@ export class PostArrays {
|
||||
lseg: string[] | string[][];
|
||||
|
||||
@Column("box", { array: true })
|
||||
box: string[] | Object[];
|
||||
box: string[] | object[];
|
||||
|
||||
@Column("path", { array: true })
|
||||
path: string[];
|
||||
@ -141,7 +141,7 @@ export class PostArrays {
|
||||
polygon: string[];
|
||||
|
||||
@Column("circle", { array: true })
|
||||
circle: string[] | Object[];
|
||||
circle: string[] | object[];
|
||||
|
||||
@Column("cidr", { array: true })
|
||||
cidr: string[];
|
||||
@ -165,10 +165,10 @@ export class PostArrays {
|
||||
xml: string[];
|
||||
|
||||
@Column("json", { array: true })
|
||||
json: Object[];
|
||||
json: object[];
|
||||
|
||||
@Column("jsonb", { array: true })
|
||||
jsonb: Object[];
|
||||
jsonb: object[];
|
||||
|
||||
@Column("int4range", { array: true })
|
||||
int4range: string[];
|
||||
|
Loading…
Reference in New Issue
Block a user