Documentation
¶
Index ¶
- Constants
- type Duration
- func (d Duration) MarshalJSON() ([]byte, error)
- func (d *Duration) MarshalText() ([]byte, error)
- func (d Duration) MarshalYAML() (interface{}, error)
- func (d *Duration) Set(s string) error
- func (d Duration) String() string
- func (d *Duration) Type() string
- func (d *Duration) UnmarshalJSON(bytes []byte) error
- func (d *Duration) UnmarshalText(text []byte) error
- func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Interval
- type Time
- func (t Time) Add(d time.Duration) Time
- func (t Time) After(o Time) bool
- func (t Time) Before(o Time) bool
- func (t Time) Equal(o Time) bool
- func (t Time) MarshalJSON() ([]byte, error)
- func (t Time) String() string
- func (t Time) Sub(o Time) time.Duration
- func (t Time) Time() time.Time
- func (t Time) Unix() int64
- func (t Time) UnixNano() int64
- func (t *Time) UnmarshalJSON(b []byte) error
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Duration ¶
Duration wraps time.Duration. It is used to parse the custom duration format from YAML. This type should not propagate beyond the scope of input/output processing.
func ParseDuration ¶
ParseDuration parses a string into a time.Duration, assuming that a year always has 365d, a week always has 7d, and a day always has 24h.
func (Duration) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*Duration) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (Duration) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Duration) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (*Duration) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type Interval ¶
type Interval struct {
Start, End Time
}
Interval describes an interval between two timestamps.
type Time ¶
type Time int64
Time is the number of milliseconds since the epoch (1970-01-01 00:00 UTC) excluding leap seconds.
func TimeFromUnix ¶
TimeFromUnix returns the Time equivalent to the Unix Time t provided in seconds.
func TimeFromUnixNano ¶
TimeFromUnixNano returns the Time equivalent to the Unix Time t provided in nanoseconds.
func (Time) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (Time) Unix ¶
Unix returns t as a Unix time, the number of seconds elapsed since January 1, 1970 UTC.
func (Time) UnixNano ¶
UnixNano returns t as a Unix time, the number of nanoseconds elapsed since January 1, 1970 UTC.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.