Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotMap = errors.New("cannot unmarshal into Map, not a json object")
ErrNotMap is returned when Map.UnmarshalJSON is called with bytes not representing null or a json object.
Functions ¶
This section is empty.
Types ¶
type Duration ¶
Duration is a time.Duration with JSON unmarshaling that uses time.ParseDuration.
func (Duration) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON fulfills the encoding/json.Unmarshaler interface. It attempts to parse text as a time.Duration string. The Go documentation defines this as a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h"). If there is no time unit, UnmarshalJSON defaults to ms.
type HexBytes ¶
type HexBytes []byte
HexBytes is a byte slice with hex encoding and decoding when marshaled and unmarshaled.
func (HexBytes) MarshalText ¶
MarshalText satisfies the encoding.TextMarshaler interface.
func (*HexBytes) UnmarshalText ¶
UnmarshalText satisfies the encoding.TextUnmarshaler interface
type Map ¶
type Map []byte
Map is a byte slice that should parse as a string encoding a JSON object. This is checked in UnmarshalJSON.
func (Map) MarshalJSON ¶
MarshalJSON satisfies the json.Marshaler interface.
func (*Map) UnmarshalJSON ¶
UnmarshalJSON satisfies the json.Unmarshaler interface.