Skip to content

sql.NullTime doesn't work for postgres #54

@tamim

Description

@tamim

sql.NullTime is not working as expected in the postgres db.

Here is an example -

type SampleEvent struct {
	ID        string   `db:"id"`
	CreatedAt sql.NullTime `db:"created_at"`
}

modl is creating this table such as the created_at column is varchar instead of timestamp.

The fix is in dialect.go file, line 255

case "Time", "Nulltime":
	return "timestamp with time zone"

here Nulltime should be NullTime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions