timestamp

package
v0.0.0-...-389bc3b Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const TimestampFormatLayout = "2006-01-02 15:04:05"

TimestampFormatLayout formatlayout, save in mysql

Variables

This section is empty.

Functions

func AutoSet

func AutoSet(data interface{}, fields ...string)

AutoSet auto set type

Types

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp unix timestamp

func Date

func Date(year int, month time.Month, day, hour, min, sec, nsec int, loc *time.Location) Timestamp

Date return time with date

func New

func New() Timestamp

New return timestamp

func NewWithTime

func NewWithTime(t time.Time) Timestamp

NewWithTime return a specified time's Timestamp

func Now

func Now() Timestamp

Now returns the current local time.

func Unix

func Unix(sec int64, nsec int64) Timestamp

Unix returns the local Time corresponding to the given Unix time,

func (Timestamp) GetBSON

func (t Timestamp) GetBSON() (interface{}, error)

GetBSON implements the bson Getter interface

func (Timestamp) MarshalJSON

func (t Timestamp) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Timestamp) Pointer

func (t Timestamp) Pointer() *Timestamp

Pointer return timestamp point

func (*Timestamp) Scan

func (t *Timestamp) Scan(value interface{}) error

Scan valueof time.Time

func (*Timestamp) SetBSON

func (t *Timestamp) SetBSON(raw bson.Raw) error

SetBSON implements the bson Setter interface

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (Timestamp) Value

func (t Timestamp) Value() (driver.Value, error)

Value insert timestamp into mysql need this function.

Jump to

Keyboard shortcuts

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