Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidDuration = errors.New("invalid duration")
ErrInvalidDuration is error returned if no duration can be encoded or decoded.
var ErrInvalidOctalMode = errors.New("invalid file mode in octal representation")
ErrInvalidOctalMode is error returned if no file mode can be encoded or decoded.
var ErrInvalidURL = errors.New("invalid url")
ErrInvalidURL is error returned if no URL can be encoded or decoded.
Functions ¶
This section is empty.
Types ¶
type Bytes ¶
type Bytes float64
Bytes is a helper type that represents length of data in bytes.
func (Bytes) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface. It marshals a string representation of length of bytes.
func (Bytes) MarshalText ¶
MarshalText implements encoding.TextMarshaler interface. It marshals a string representation of length of bytes.
func (*Bytes) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface. It parses length of bytes string.
func (*Bytes) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler interface. It parses length of bytes string.
type Checkbox ¶
type Checkbox bool
Checkbox is a helper type to unmarshal value from HTML checkbox into boolean.
func (Checkbox) MarshalJSON ¶
MarshalJSON returns the JSON encoding of Checkbox.
- "on" if it is checked
- false if it is not checked
func (*Checkbox) UnmarshalJSON ¶
UnmarshalJSON parses the JSON-encoded data and sets Checkbox to true or false.
type Duration ¶
Duration is a helper type that wraps time.Duration to JSON encode and decode durations in humanly readable form.
func (Duration) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface. It marshals a string representation of time.Duration.
func (Duration) MarshalText ¶
MarshalText implements encoding.TextMarshaler interface. It marshals a string representation of time.Duration.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface. It parses time.Duration string.
func (*Duration) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler interface. It parses time.Duration string.
type Mode ¶
type Mode int
Mode is a helper type that can JSON encode and decode integers used as file mode in octal representation.
func (Mode) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface. It marshals a string of octal representation of integer.
func (Mode) MarshalText ¶
MarshalText implements encoding.TextMarshaler interface. It marshals a string of octal representation of integer.
func (*Mode) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface. It parses octal representations of integer.
func (*Mode) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler interface. It parses octal representations of integer.
type URL ¶
URL is a helper type that wraps url.URL to JSON encode and decode URLs.
func (URL) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface. It marshals a string representation of url.URL.
func (URL) MarshalText ¶
MarshalText implements encoding.TextMarshaler interface. It marshals a string representation of url.URL.
func (*URL) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface. It parses url.URL string.
func (*URL) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler interface. It parses url.URL string.