types

package
v0.31.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
var ErrDateNotJSONString = errors.New("cannot parse non-string value as a date")
View Source
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

type Duration struct {
	time.Duration
}

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 (d Duration) MarshalJSON() ([]byte, error)

func (Duration) MarshalYAML added in v0.28.0

func (d Duration) MarshalYAML() (any, error)

func (*Duration) UnmarshalJSON added in v0.28.0

func (d *Duration) UnmarshalJSON(data []byte) error

func (*Duration) UnmarshalYAML added in v0.28.0

func (d *Duration) UnmarshalYAML(value *yaml.Node) error

type SerializableDate

type SerializableDate struct {
	time.Time
}

func (SerializableDate) MarshalJSON

func (date SerializableDate) MarshalJSON() ([]byte, error)

func (*SerializableDate) UnmarshalJSON

func (date *SerializableDate) UnmarshalJSON(data []byte) error

type SerializableTime

type SerializableTime struct {
	time.Time
}

func (SerializableTime) MarshalJSON

func (t SerializableTime) MarshalJSON() ([]byte, error)

func (*SerializableTime) UnmarshalJSON

func (t *SerializableTime) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL