timetool

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MyTime

type MyTime struct {
	time.Time
}

1. 创建 time.Time 类型的副本 XTime;

func (*MyTime) GetTime

func (t *MyTime) GetTime() time.Time

func (MyTime) MarshalJSON

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

2. 为 Xtime 重写 MarshaJSON 方法,在此方法中实现自定义格式的转换;

func (*MyTime) Scan

func (t *MyTime) Scan(v interface{}) error

4. 为 Xtime 实现 Scan 方法,读取数据库时会调用该方法将时间数据转换成自定义时间类型;

func (*MyTime) String

func (t *MyTime) String() string

func (MyTime) Value

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

3. 为 Xtime 实现 Value 方法,写入数据库时会调用该方法将自定义时间类型转换并写入数据库;

type TimeZone

type TimeZone struct {
	//时区
	TimeZone string
	//时间偏移
	TimeOffset int
}
var TimeLocal TimeZone

时区

Jump to

Keyboard shortcuts

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