Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrDurationNotISO8601 = errors.New("not an ISO 8601 duration") ErrDurationOutOfRange = errors.New("duration out of range") ErrDurationNotJSON = errors.New("cannot parse a JSON value that is neither a string nor a number as a duration") ErrDurationNotYAMLText = errors.New("cannot parse a YAML value that is not a string as a duration") )
var ErrDateNotJSONString = errors.New("cannot parse non-string value as a date")
var ErrTimeNotJSONString = errors.New("cannot parse non-string value as a time")
Functions ¶
This section is empty.
Types ¶
type Duration ¶ added in v0.28.0
Duration is a time.Duration held as an ISO 8601 duration, such as "PT1H30M", which is what JSON Schema's format "duration" describes.
JSON gives it as such a string, or as a number of nanoseconds, the way encoding/json reads a time.Duration. YAML gives it as such a string, or in Go's syntax, such as "1h30m", the way yaml.v3 reads a time.Duration. A year counts as 365 days and a month as a twelfth of that. It is written as an ISO 8601 duration of hours, minutes and seconds, which hold it exactly, such as "PT36H" for a day and a half.
func (Duration) MarshalJSON ¶ added in v0.28.0
func (Duration) MarshalYAML ¶ added in v0.28.0
func (*Duration) UnmarshalJSON ¶ added in v0.28.0
type SerializableDate ¶
func (SerializableDate) MarshalJSON ¶
func (date SerializableDate) MarshalJSON() ([]byte, error)
func (*SerializableDate) UnmarshalJSON ¶
func (date *SerializableDate) UnmarshalJSON(data []byte) error
type SerializableTime ¶
func (SerializableTime) MarshalJSON ¶
func (t SerializableTime) MarshalJSON() ([]byte, error)
func (*SerializableTime) UnmarshalJSON ¶
func (t *SerializableTime) UnmarshalJSON(data []byte) error