util

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2023 License: Apache-2.0 Imports: 2 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TimeWithTrailingZeroMsec deprecated

type TimeWithTrailingZeroMsec = afgotime.TimeWithTrailingZeroMsec

TimeWithTrailingZeroMsec overrides marshalling of time.Time. It keeps a format of initial unmarshalling in case when date has zero a fractional second (e.g. ".000"). For example, time.Time marshals 2018-03-15T00:00:00.000Z to 2018-03-15T00:00:00Z while TimeWithTrailingZeroMsec marshals to the initial 2018-03-15T00:00:00.000Z value.

Deprecated: use TimeWrapper instead.

type TimeWrapper added in v0.1.7

type TimeWrapper = afgotime.TimeWrapper

TimeWrapper overrides marshalling of time.Time. If a TimeWrapper is created from a time string, or unmarshalled from JSON, it saves the string literal, which it uses when marshalling. If a TimeWrapper is created using NewTime or a struct literal, it marshals with the default time.RFC3339 format.

func NewTime

func NewTime(t time.Time) *TimeWrapper

NewTime creates a TimeWrapper wrapped around the given time.Time. It functions as a normal time.Time object.

func NewTimeWithTrailingZeroMsec deprecated

func NewTimeWithTrailingZeroMsec(t time.Time, _ int) *TimeWrapper

NewTimeWithTrailingZeroMsec creates a TimeWrapper wrapped around the given time.Time.

Deprecated: use NewTime instead. For sub-zero precision, use ParseTimeWrapper on a string with the desired precision.

func ParseTimeWithTrailingZeroMsec deprecated

func ParseTimeWithTrailingZeroMsec(timeStr string) (*TimeWrapper, error)

ParseTimeWithTrailingZeroMsec parses a formatted string and returns the time value it represents.

Deprecated: use ParseTimeWrapper instead.

func ParseTimeWrapper added in v0.1.7

func ParseTimeWrapper(timeStr string) (*TimeWrapper, error)

ParseTimeWrapper parses a formatted string and returns the time value it represents.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL