Documentation
¶
Index ¶
- Variables
- func AddTimeInputLayouts(layouts ...string)
- func GetTimeInputLayouts() []string
- func GetTimeOutputLayout() string
- func GetTimezone() *time.Location
- func SetTimeOutputLayout(layout string)
- func SetTimezone(timezone *time.Location)
- type Datetime
- type Timestamp
- func (Timestamp) DBType(_ string) string
- func (t Timestamp) Format(layout string) string
- func (t Timestamp) Int() int64
- func (t Timestamp) IsZero() bool
- func (t Timestamp) MarshalJSON() ([]byte, error)
- func (t Timestamp) MarshalText() ([]byte, error)
- func (t *Timestamp) Scan(src any) error
- func (t Timestamp) String() string
- func (t *Timestamp) UnmarshalJSON(data []byte) error
- func (t *Timestamp) UnmarshalText(data []byte) error
- func (t Timestamp) Unwrap() time.Time
- func (t Timestamp) Value() (driver.Value, error)
- type TimestampMilli
- func (TimestampMilli) DBType(_ string) string
- func (t TimestampMilli) Format(layout string) string
- func (t TimestampMilli) Int() int64
- func (t TimestampMilli) IsZero() bool
- func (t TimestampMilli) MarshalJSON() ([]byte, error)
- func (t TimestampMilli) MarshalText() ([]byte, error)
- func (t *TimestampMilli) Scan(src any) error
- func (t TimestampMilli) String() string
- func (t *TimestampMilli) UnmarshalJSON(data []byte) error
- func (t *TimestampMilli) UnmarshalText(data []byte) error
- func (t TimestampMilli) Unwrap() time.Time
- func (t TimestampMilli) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( UTC = time.UTC // CST Chinese Standard Timezone CST = must.NoErrorV(time.LoadLocation("Asia/Shanghai")) // JST Japan Standard Timezone JST = must.NoErrorV(time.LoadLocation("Asia/Tokyo")) // KST Korea Standard Timezone KST = must.NoErrorV(time.LoadLocation("Asia/Seoul")) // IST Indochina Standard Timezone (Thailand) IST = must.NoErrorV(time.LoadLocation("Asia/Bangkok")) TimestampZero = Timestamp{time.Time{}} TimestampUnixZero = Timestamp{time.Unix(0, 0)} TimestampMilliZero = TimestampMilli{time.Time{}} TimestampMilliUnixZero = TimestampMilli{time.Unix(0, 0)} RFC3339 = time.RFC3339 RFC3339Milli = "2006-01-02T15:04:05.999Z07:00" DateTime = time.DateTime DateTimeMilli = "2006-01-02 15:04:05.000" DefaultOutputLayout = RFC3339Milli )
View Source
var ( DatetimeZero = Datetime{Timestamp: TimestampZero} DatetimeUnixZero = Datetime{Timestamp: TimestampUnixZero} DatetimeEpoch = "1970-01-01 00:00:00" DatetimeEpochPrecision = "1970-01-01 00:00:00.000" )
Functions ¶
func AddTimeInputLayouts ¶
func AddTimeInputLayouts(layouts ...string)
func GetTimeInputLayouts ¶
func GetTimeInputLayouts() []string
func GetTimeOutputLayout ¶
func GetTimeOutputLayout() string
func GetTimezone ¶
func SetTimeOutputLayout ¶
func SetTimeOutputLayout(layout string)
func SetTimezone ¶
Types ¶
type Timestamp ¶
Timestamp as seconds precision
func AsTimestamp ¶
func ParseTimestamp ¶
func (Timestamp) MarshalJSON ¶
func (Timestamp) MarshalText ¶
func (*Timestamp) UnmarshalJSON ¶
func (*Timestamp) UnmarshalText ¶
type TimestampMilli ¶
func AsTimestampMilli ¶
func AsTimestampMilli(t time.Time) TimestampMilli
func ParseTimestampMilli ¶
func ParseTimestampMilli(input string) (d TimestampMilli, err error)
func ParseTimestampMilliWithLayout ¶
func ParseTimestampMilliWithLayout(input, layout string) (TimestampMilli, error)
func (TimestampMilli) DBType ¶
func (TimestampMilli) DBType(_ string) string
func (TimestampMilli) Format ¶
func (t TimestampMilli) Format(layout string) string
func (TimestampMilli) Int ¶
func (t TimestampMilli) Int() int64
func (TimestampMilli) IsZero ¶
func (t TimestampMilli) IsZero() bool
func (TimestampMilli) MarshalJSON ¶
func (t TimestampMilli) MarshalJSON() ([]byte, error)
func (TimestampMilli) MarshalText ¶
func (t TimestampMilli) MarshalText() ([]byte, error)
func (*TimestampMilli) Scan ¶
func (t *TimestampMilli) Scan(src any) error
func (TimestampMilli) String ¶
func (t TimestampMilli) String() string
func (*TimestampMilli) UnmarshalJSON ¶
func (t *TimestampMilli) UnmarshalJSON(data []byte) error
func (*TimestampMilli) UnmarshalText ¶
func (t *TimestampMilli) UnmarshalText(data []byte) error
func (TimestampMilli) Unwrap ¶
func (t TimestampMilli) Unwrap() time.Time
Click to show internal directories.
Click to hide internal directories.