From 311f62313f6486f6c18432f12ee865dc29698c91 Mon Sep 17 00:00:00 2001 From: "Visal .In" Date: Tue, 17 Dec 2024 18:34:58 +0700 Subject: [PATCH] add support postgre timestamp (#15) --- electron/drivers/postgres.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/electron/drivers/postgres.ts b/electron/drivers/postgres.ts index 9e6face..c74c360 100644 --- a/electron/drivers/postgres.ts +++ b/electron/drivers/postgres.ts @@ -2,6 +2,12 @@ import BaseDriver, { ColumnType, Result } from "./base"; import pg, { type ConnectionConfig, type FieldDef, type PoolClient } from "pg"; import { transformArrayBasedResult } from "./transformer"; +pg.types.setTypeParser(pg.types.builtins.TIME, (timeStr) => timeStr); +pg.types.setTypeParser(pg.types.builtins.TIMESTAMP, (timeStr) => timeStr); +pg.types.setTypeParser(pg.types.builtins.TIMESTAMPTZ, (timeStr) => timeStr); +pg.types.setTypeParser(pg.types.builtins.DATE, (timeStr) => timeStr); +pg.types.setTypeParser(pg.types.builtins.TIME, (timeStr) => timeStr); + export default class PostgresDriver extends BaseDriver { protected db: pg.Pool;