Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ZeroTime = time.Time{}
ZeroTime is a zero time.
Functions ¶
func BytesToUint64 ¶
BytesToUint64 converts a byte slice to uint64.
func ParseTimestamp ¶
ParseTimestamp returns a timestamp for a given byte slice.
func SubTimeByWallClock ¶
SubTimeByWallClock returns the duration between two different timestamps.
func Uint64ToBytes ¶
Uint64ToBytes converts uint64 to a byte slice.
Types ¶
type ByteSize ¶
type ByteSize uint64
ByteSize is a retype uint64 for TOML and JSON.
func (ByteSize) MarshalJSON ¶
MarshalJSON returns the size as a JSON string.
func (*ByteSize) UnmarshalJSON ¶
UnmarshalJSON parses a JSON string into the bytesize.
func (*ByteSize) UnmarshalText ¶
UnmarshalText parses a Toml string into the bytesize.
type Duration ¶
Duration is a wrapper of time.Duration for TOML and JSON.
func NewDuration ¶
NewDuration creates a Duration from time.Duration.
func (*Duration) MarshalJSON ¶
MarshalJSON returns the duration as a JSON string.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON parses a JSON string into the duration.
func (*Duration) UnmarshalText ¶
UnmarshalText parses a TOML string into the duration.
type StringSlice ¶
type StringSlice []string
StringSlice is more friendly to json encode/decode
func (StringSlice) MarshalJSON ¶
func (s StringSlice) MarshalJSON() ([]byte, error)
MarshalJSON returns the size as a JSON string.
func (*StringSlice) UnmarshalJSON ¶
func (s *StringSlice) UnmarshalJSON(text []byte) error
UnmarshalJSON parses a JSON string into the bytesize.