Documentation ¶
Overview ¶
unixtimestamp package provides a time.Time wrapper that marshals to/from Unix timestamp (integer, seconds)
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Endian = binary.LittleEndian
Endian is the default byte order for UnixTimestamp for MarshalBinary interface
View Source
var Errorf = fmt.Errorf
View Source
var FuncFrom = FSeconds // Change FuncTo also. consider FMilli.
View Source
var FuncTo = TSeconds // consider TMilli
View Source
var NoCheckTimeScan bool
Functions ¶
Types ¶
type UnixTimestamp ¶
type UnixTimestamp = UnixTimestampNull
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 (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) Scan ¶ added in v0.0.5
func (u *UnixTimestamp) Scan(v interface{}) 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
type UnixTimestampNotNull ¶ added in v0.0.6
type UnixTimestampNotNull struct {
UnixTimestamp
}
type UnixTimestampNull ¶ added in v0.0.6
Click to show internal directories.
Click to hide internal directories.