IrenejMarc/dpq

DateTime deserialization is not correct

Closed this issue · 1 comments

o3o commented

With this table:

- Table: m1
-- DROP TABLE m1;
CREATE TABLE m1
(
  id bigserial NOT NULL,
  created_at timestamp with time zone DEFAULT now(),
  CONSTRAINT m1_id_pkey PRIMARY KEY (id)
)

and:

@relation("m1") struct M1 {
   @serial @PK @attr("id") int id;
   @attr("created_at") SysTime createdAt;
}
void main() {
   Connection conn = Connection(CONN_STRING);
   writefln("curr time %s", Clock.currTime);

   conn.remove!M1("id > $1", 0);
   conn.insert!M1(M1(0, Clock.currTime));
   auto m1 = conn.findOne!M1("id > $1", 0);
   writeln(m1);
}

result is:

curr time 2019-Nov-18 08:50:41.2532661
M1(0, 2019-Nov-18 07:50:41.31466)