Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrTooBig = errors.New("interval overflows time.Duration")
ErrTooBig is returned by Interval.Duration and Duration.Scan if the interval would overflow a time.Duration.
Functions ¶
This section is empty.
Types ¶
type Duration ¶
Duration is a time.Duration alias that supports the following additional interfaces: - driver.Valuer - sql.Scanner - json.Marshaler - json.Unmarshaler
func (Duration) MarshalJSON ¶
MarshalJSON implements json.Marshaler. IMPORTANT NOTE: We are serializing Duration as an *integer* number of minutes. For our use case, this is sufficient: we don't need any more precision than minute.
func (Duration) Milliseconds ¶
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler
type Interval ¶
type Interval struct {
// contains filtered or unexported fields
}
Interval can represent the full range of PostgreSQL's interval type.
func (Interval) Duration ¶
Duration converts an Interval into a time.Duration with the same semantics as `EXTRACT(EPOCH from <interval>)` in PostgreSQL.
func (Interval) Microseconds ¶
Microseconds returns the number of microseconds in the interval, up to the number of microseconds in an hour.
type NullDuration ¶
func NewNullDuration ¶
func NewNullDuration(d Duration, valid bool) NullDuration
func (NullDuration) MarshalJSON ¶
func (nd NullDuration) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler. IMPORTANT NOTE: We are serializing NullDuration as an *integer* number of milliseconds. For our use case, this is sufficient: we don't need any more precision than millisecond.
func (NullDuration) Milliseconds ¶
func (nd NullDuration) Milliseconds() float64
Milliseconds returns the number of milliseconds in the duration
func (*NullDuration) Scan ¶
func (nd *NullDuration) Scan(src interface{}) error
func (*NullDuration) UnmarshalJSON ¶
func (nd *NullDuration) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler
type NullInterval ¶
func (*NullInterval) Scan ¶
func (nival *NullInterval) Scan(src interface{}) error