Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseDuration ¶
ParseDuration parses a duration string. A duration string is 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", "d", "w", "y".
Types ¶
type DurationOption ¶
DurationOption is a type for parsing a duration string passed through a config file or by other means into a time.Duration. It implements the json.Unmarshaler and yaml.Unmarshaler interfaces. It also implements marshaler interfaces, but that output is not well readable by humans.
func (DurationOption) Duration ¶
func (do DurationOption) Duration() time.Duration
Duration returns the time.Duration
func (DurationOption) MarshalJSON ¶
func (do DurationOption) MarshalJSON() (b []byte, err error)
MarshalJSON implements the json.Marshaler interface
func (DurationOption) MarshalYAML ¶
func (do DurationOption) MarshalYAML() (interface{}, error)
MarshalYAML implements the yaml.Marshaler interface
func (*DurationOption) UnmarshalJSON ¶
func (do *DurationOption) UnmarshalJSON(bytes []byte) error
UnmarshalJSON implements the json.Unmarshaler interface
func (*DurationOption) UnmarshalYAML ¶
func (do *DurationOption) UnmarshalYAML(n *yaml.Node) error
UnmarshalYAML implements the yaml.Unmarshaler interface