最佳答案我已经遇到是使用bigint你的架构,并实现Value与Scan上一个包装类型time.Duration。// Duration lets us convert between a bigint in Postgres and time.Duration// in Gotype Duration time.Duration// Value converts Duration to a primitive value ready to written to a database.func (d Duration) Value() (driver.Value, error) { return driver.Value(int64(d)), nil}// Scan reads a Duration value from database driver type.func (d *Duration) Scan(raw interface{}) error { switch v := raw.(type) { case int64: *d = Duration(v) case nil: *d = Duration(0) default: return fmt.Errorf("cannot sql.Scan() strfmt.Duration from: %#v", v) } return nil}不幸的是,您将牺牲在查询中进行区间算术的能力 - 除非一些聪明的人想要发布bigint=>的类型转换interval。