Documentation ¶
Overview ¶
Package nnduration provides JSON-friendly non-negative duration types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Milliseconds ¶
type Milliseconds uint64
Milliseconds is a duration in milliseconds unit.
func (Milliseconds) Duration ¶
func (d Milliseconds) Duration() time.Duration
Duration converts this to time.Duration.
func (Milliseconds) DurationOr ¶
func (d Milliseconds) DurationOr(dflt Milliseconds) time.Duration
DurationOr converts this to time.Duration, but returns dflt if this is zero.
func (*Milliseconds) UnmarshalJSON ¶
func (d *Milliseconds) UnmarshalJSON(p []byte) (e error)
UnmarshalJSON implements json.Unmarshaler interface. It accepts either an integer as milliseconds, or a duration string specified by time.ParseDuration.
type Nanoseconds ¶
type Nanoseconds uint64
Nanoseconds is a duration in nanoseconds unit.
func (Nanoseconds) Duration ¶
func (d Nanoseconds) Duration() time.Duration
Duration converts this to time.Duration.
func (Nanoseconds) DurationOr ¶
func (d Nanoseconds) DurationOr(dflt Nanoseconds) time.Duration
DurationOr converts this to time.Duration, but returns dflt if this is zero.
func (*Nanoseconds) UnmarshalJSON ¶
func (d *Nanoseconds) UnmarshalJSON(p []byte) (e error)
UnmarshalJSON implements json.Unmarshaler interface. It accepts either an integer as nanoseconds, or a duration string specified by time.ParseDuration.