Merge pull request #83 from mingyang91/master

Fixed: duplicate JSON.parse
This commit is contained in:
Umed Khudoiberdiev 2016-11-10 15:40:47 +05:00 committed by GitHub
commit 1c403fd107

View File

@ -189,7 +189,9 @@ export class PostgresDriver implements Driver {
case ColumnTypes.DATETIME:
return moment(value).format("YYYY-MM-DD HH:mm:ss");
case ColumnTypes.JSON:
return JSON.stringify(value);
// pg(pg-types) have done JSON.parse conversion
// https://github.com/brianc/node-pg-types/blob/ed2d0e36e33217b34530727a98d20b325389e73a/lib/textParsers.js#L170
return value;
case ColumnTypes.SIMPLE_ARRAY:
return (value as any[])
.map(i => String(i))