timeutil

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TimeStamp

type TimeStamp int64

TimeStamp is a type which holds a unix timestamp, but becomes a RFC3339 date when parsed to json. This allows us to save the time as a unix timestamp into the database while returning it as an iso date to the api client.

func FromTime

func FromTime(t time.Time) TimeStamp

FromTime converts a time.Time to a TimeStamp

func (*TimeStamp) MarshalJSON

func (ts *TimeStamp) MarshalJSON() ([]byte, error)

MarshalJSON converts a TimeStamp to a json string

func (*TimeStamp) ToTime

func (ts *TimeStamp) ToTime() time.Time

ToTime returns a time.Time from a TimeStamp

func (*TimeStamp) UnmarshalJSON

func (ts *TimeStamp) UnmarshalJSON(data []byte) error

UnmarshalJSON converts an iso date string from json to a TimeStamp

Jump to

Keyboard shortcuts

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