Documentation ¶
Overview ¶
A simple relative and natural time package
A simple relative and natural time package
Index ¶
Constants ¶
const ( Today naturalAdjective = "today" Yesterday naturalAdjective = "yesterday" This naturalAdjective = "this" Current naturalAdjective = "current" Previous naturalAdjective = "previous" Last naturalAdjective = "last" )
const ( Year relativeUnit = "y" Month relativeUnit = "mon" Week relativeUnit = "w" Day relativeUnit = "d" Hour relativeUnit = "h" Minute relativeUnit = "m" Second relativeUnit = "s" )
const (
RFC3339Milli = "2006-01-02T15:04:05.000Z"
)
Variables ¶
This section is empty.
Functions ¶
func ParseNatural ¶
Parse the string representation of a Lacework natural time Start and End time objects are returned in UTC
start, end, err := lwtime.ParseNatural("this year")
if err != nil { ... }
Types ¶
type Epoch ¶ added in v0.9.1
Epoch time type to parse the returned 13 digit time in milliseconds
func (Epoch) MarshalJSON ¶ added in v0.9.1
func (Epoch) ToTime ¶ added in v0.9.1
A few format functions for printing and manipulating the custom date
func (*Epoch) UnmarshalJSON ¶ added in v0.9.1
implement Marshal and Unmarshal interfaces
type EpochString ¶ added in v0.9.1
EpochString time type to parse the returned 13 digit time in milliseconds Used instead of Epoch type when unmarshalling a json response where epoch time is a string
func (EpochString) Format ¶ added in v0.9.1
func (epoch EpochString) Format(s string) string
func (*EpochString) MarshalJSON ¶ added in v0.9.1
func (epoch *EpochString) MarshalJSON() ([]byte, error)
func (EpochString) ToTime ¶ added in v0.9.1
func (epoch EpochString) ToTime() time.Time
func (EpochString) UTC ¶ added in v0.9.1
func (epoch EpochString) UTC() time.Time
func (*EpochString) UnmarshalJSON ¶ added in v0.9.1
func (epoch *EpochString) UnmarshalJSON(b []byte) error
type NanoTime ¶ added in v0.9.1
time type to parse the returned time with nano format
Example:
"START_TIME":"2020-08-20T01:00:00+0000"
func (NanoTime) MarshalJSON ¶ added in v0.9.1
func (NanoTime) ToTime ¶ added in v0.9.1
A few format functions for printing and manipulating the custom date