Documentation ¶
Overview ¶
Package jsonutil provides a collection of types implementing the json.Unmarshaler and json.Marshaler interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Duration ¶
Duration is a wrapper around time.Duration which implements json.Unmarshaler and json.Marshaler. It marshals and unmarshals the duration as a string in the format accepted by time.ParseDuration and returned by time.Duration.String.
func FromDuration ¶
FromDuration is a convenience factory to create a Duration instance from the given time.Duration value.
func (Duration) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface. The duration is a quoted-string in the format accepted by time.ParseDuration and returned by time.Duration.String.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface. The duration is expected to be a quoted-string of a duration in the format accepted by time.ParseDuration.