Documentation
¶
Overview ¶
Package duration provides a Duration type that supports string-based and numeric YAML/JSON marshalling. It wraps time.Duration and is intended for use in any configuration struct that needs human-readable durations like "30s", "2m", or "1m30s". Numeric values (nanoseconds) are also accepted during unmarshalling for backward compatibility.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Duration ¶
Duration is a time.Duration with string-based YAML/JSON marshalling. Supports Go duration strings like "30s", "2m", "1m30s". Numeric values (nanoseconds) are accepted during unmarshalling.
func (Duration) MarshalJSON ¶
MarshalJSON implements json.Marshaler for Duration.
func (Duration) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler for Duration.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for Duration. Accepts both string durations ("30s") and numeric nanoseconds (1000000000).