Documentation ¶
Overview ¶
A simple relative and natural time package.
Index ¶
Constants ¶
View Source
const ( Today naturalAdjective = "today" Yesterday naturalAdjective = "yesterday" This naturalAdjective = "this" Current naturalAdjective = "current" Previous naturalAdjective = "previous" Last naturalAdjective = "last" )
View Source
const ( Year relativeUnit = "y" Month relativeUnit = "mon" Week relativeUnit = "w" Day relativeUnit = "d" Hour relativeUnit = "h" Minute relativeUnit = "m" Second relativeUnit = "s" HoursInADay = 24 )
View Source
const (
RFC3339Milli = "2006-01-02T15:04:05.000Z"
)
Variables ¶
This section is empty.
Functions ¶
func ParseNatural ¶
ParseNatural parses 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 ¶
Epoch time type to parse the returned 13 digit time in milliseconds
func (Epoch) MarshalJSON ¶
func (*Epoch) UnmarshalJSON ¶
type EpochString ¶
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 ¶
func (epoch EpochString) Format(s string) string
func (*EpochString) MarshalJSON ¶
func (epoch *EpochString) MarshalJSON() ([]byte, error)
func (EpochString) ToTime ¶
func (epoch EpochString) ToTime() time.Time
func (EpochString) UTC ¶
func (epoch EpochString) UTC() time.Time
func (*EpochString) UnmarshalJSON ¶
func (epoch *EpochString) UnmarshalJSON(b []byte) error
type NanoTime ¶
NanoTime time type to parse the returned time with nano format
Example: "2020-08-20T01:00:00+0000"
func (NanoTime) MarshalJSON ¶
func (*NanoTime) UnmarshalJSON ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.