Documentation ¶
Index ¶
- Constants
- func ParseDuration(s string) (time.Duration, error)
- type Duration
- func (d Duration) D() time.Duration
- func (d *Duration) DecodeMsg(reader *msgp.Reader) error
- func (d Duration) EncodeMsg(w *msgp.Writer) error
- func (d Duration) MarshalMsg(bytes []byte) ([]byte, error)
- func (d Duration) MarshalYAML() (interface{}, error)
- func (d Duration) Msgsize() int
- func (d *Duration) UnmarshalJSON(bs []byte) error
- func (d *Duration) UnmarshalMsg(b []byte) ([]byte, error)
- func (d *Duration) UnmarshalYAML(value *yaml.Node) error
Constants ¶
Additional durations, a day is considered to be 24 hours
Variables ¶
This section is empty.
Functions ¶
func ParseDuration ¶
ParseDuration parses a duration string. The following code is borrowed from time.ParseDuration https://cs.opensource.google/go/go/+/refs/tags/go1.22.5:src/time/format.go;l=1589 This function extends this function by allowing support for days and weeks. This function must only be used when days and weeks are necessary inputs in all other cases it is preferred that a user uses Go's time.ParseDuration
Types ¶
type Duration ¶ added in v3.0.7
Duration is a wrapper around time.Duration that supports YAML and JSON
func (*Duration) DecodeMsg ¶ added in v3.0.9
DecodeMsg decodes itself as MessagePack using a *msgp.Reader.
func (Duration) EncodeMsg ¶ added in v3.0.9
EncodeMsg writes itself as MessagePack using a *msgp.Writer.
func (Duration) MarshalMsg ¶ added in v3.0.9
MarshalMsg appends the marshaled form of the object to the provided byte slice, returning the extended slice and any errors encountered.
func (Duration) MarshalYAML ¶ added in v3.0.22
MarshalYAML implements yaml.Marshaler - Converts duration to human-readable format (e.g., "2h", "30m")
func (*Duration) UnmarshalJSON ¶ added in v3.0.7
UnmarshalJSON implements json.Unmarshaler
func (*Duration) UnmarshalMsg ¶ added in v3.0.9
UnmarshalMsg unmarshals the object from binary, returing any leftover bytes and any errors encountered.
func (*Duration) UnmarshalYAML ¶ added in v3.0.7
UnmarshalYAML implements yaml.Unmarshaler