Documentation ¶
Overview ¶
unixtimestamp package provides a time.Time wrapper that marshals to/from Unix timestamp (integer, seconds)
Index ¶
- Variables
- func FMicro(t time.Time) int64
- func FMilli(t time.Time) int64
- func FSeconds(t time.Time) int64
- func TMicro(i int64) time.Time
- func TMilli(i int64) time.Time
- func TSeconds(i int64) time.Time
- type UnixTimestamp
- func (ut UnixTimestamp) MarshalBinary() ([]byte, error)
- func (ut UnixTimestamp) MarshalJSON() ([]byte, error)
- func (u *UnixTimestamp) Scan(v interface{}) error
- func (ut *UnixTimestamp) String() string
- func (ut *UnixTimestamp) UnmarshalBinary(dat []byte) error
- func (ut *UnixTimestamp) UnmarshalJSON(dat []byte) error
- func (u *UnixTimestamp) Value() (driver.Value, error)
- type UnixTimestampNotNull
- type UnixTimestampNull
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) String ¶ added in v0.0.7
func (ut *UnixTimestamp) String() string
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.