unixtimestamp

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Endian is the default byte order for UnixTimestamp for MarshalBinary interface

Functions

This section is empty.

Types

type UnixTimestamp

type UnixTimestamp struct {
	time.Time
}

UnixTimestamp is a time.Time that marshals to/from Unix timestamp (seconds) Use pointer (*UnixTimestamp) and `omitempty` in structs for JSON marshaling Use Wrap(t) or Now() to create a UnixTimestamp

func New

func New(t time.Time) *UnixTimestamp

New existing time.Time

func Now

func Now() *UnixTimestamp

Now returns a new UnixTimestamp for the current time

func (UnixTimestamp) MarshalBinary

func (ut UnixTimestamp) MarshalBinary() ([]byte, error)

MarshalBinary uses Endian var, set Endian to binary.BigEndian if needed

func (UnixTimestamp) MarshalJSON

func (ut UnixTimestamp) MarshalJSON() ([]byte, error)

func (*UnixTimestamp) UnmarshalBinary

func (ut *UnixTimestamp) UnmarshalBinary(dat []byte) error

UnmarshalBinary uses Endian var, set Endian to binary.BigEndian if needed

func (*UnixTimestamp) UnmarshalJSON

func (ut *UnixTimestamp) UnmarshalJSON(dat []byte) error

Jump to

Keyboard shortcuts

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