Open
Description
I'm not sure and I might be missing something, but null overrides at least for timestamp
to *time.Time
, doesn't seem to wok, text
, to *string
works.
I've also tried with timestamptz, timestamp(0), timestamp without time zone
I'm unable to debug this as the go compiler fails when building debug version in Goland with OOM.. it seems that 8G of free ram is not enough.
edit: , jsonb
to *json.RawMessage
kinda works.. it generates two imports "encoding/json"
and json "encoding/json"
version: "1"
packages:
- name: "db"
#....
overrides:
- db_type: "timestamp"
go_type:
import: "time"
package: "time"
type: "Time"
pointer: true
nullable: true
- db_type: "jsonb"
go_type:
import: "encoding/json"
package: "json"
type: "RawMessage"
pointer: true
nullable: true
CREATE TABLE office (
id_office bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
created_at timestamp(0) DEFAULT now() NOT NULL,
updated_at timestamp(0),
);
-- name: ListOffices :many
SELECT * FROM office
ORDER BY name;
This always generates
type Office struct {
IDOffice int64
CreatedAt time.Time
UpdatedAt sql.NullTime
}