Do we support field parse function?
Can u please provide more detail please.
in postgres, how did this orm map range type to golang?
I didn't found any document related to this.
it is possible to specify column type in GORM.
type Duration struct {
From time.Time
To time.Time
}
func (d *Duration) Scan(src interface{}) error {
panic("implement me")
}
func (d Duration) Value() (driver.Value, error) {
return fmt.Sprintf(
"[%s, %s)",
d.From.Format("2006-01-02 15:04"),
d.To.Format("2006-01-02 15:04"),
), nil
}
type Booking struct {
ID int `gorm:"primary_key"`
Duration Duration `gorm:"type:tsrange;column:duration;not null"`
}
@rustjason fixed?
Most helpful comment
it is possible to specify column type in GORM.