g2time

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//TimeZone ...
	TimeZone = "Asia/Shanghai"
	//Custom ...
	Custom = "2006-01-02 15:04:05"
	//DateLayout ...
	DateLayout = "2006-01-02"
)

Variables

View Source
var TimeNowFunc = time.Now

TimeNowFunc ...

Functions

func RetryDo

func RetryDo(fn func() error, intervalSecond int64) error

RetryDo 重试行为

func RetryDoTimes

func RetryDoTimes(times, intervalSecond int64, fn func() error) error

RetryDoTimes ...

func SetTimeZone

func SetTimeZone() error

SetTimeZone ...Shanghai

func TimeExcWrap

func TimeExcWrap(fn func()) time.Duration

TimeExcWrap 包装执行时间

func TimeNow

func TimeNow() time.Time

TimeNow ...

func TodayDate

func TodayDate() string

TodayDate ...

Types

type JSONTime

type JSONTime time.Time

JSONTime ...

func Must2JSONTimeAddr

func Must2JSONTimeAddr(in string) *JSONTime

Must2JSONTimeAddr maybe panic

func NewJSONTimeOfTime

func NewJSONTimeOfTime(t time.Time) *JSONTime

NewJSONTimeOfTime 时间转换为JSONTime

func Now

func Now() *JSONTime

Now 当前时间

func ToDatetime

func ToDatetime(in string) (JSONTime, error)

ToDatetime ...

func Today

func Today() *JSONTime

Today ...今日日期

func (*JSONTime) Add

func (p *JSONTime) Add(d time.Duration) *JSONTime

Add ...

func (JSONTime) Addr

func (p JSONTime) Addr() *JSONTime

Addr ...

func (*JSONTime) Convert2Time

func (p *JSONTime) Convert2Time() time.Time

Convert2Time ...

func (*JSONTime) Date

func (p *JSONTime) Date() *JSONTime

Date ...返回一个日期0点的时间

func (*JSONTime) FromDB

func (p *JSONTime) FromDB(data []byte) error

FromDB ...

func (*JSONTime) GobDecode

func (p *JSONTime) GobDecode(data []byte) error

GobDecode implements the gob.GobDecoder interface.

func (*JSONTime) GobEncode

func (p *JSONTime) GobEncode() ([]byte, error)

GobEncode implements the gob.GobEncoder interface.

func (*JSONTime) MarshalJSON

func (p *JSONTime) MarshalJSON() ([]byte, error)

MarshalJSON ...

func (*JSONTime) Scan

func (p *JSONTime) Scan(v interface{}) error

Scan valueof time.Time

func (*JSONTime) SetByTime

func (p *JSONTime) SetByTime(timeVal time.Time)

SetByTime ...

func (*JSONTime) String

func (p *JSONTime) String() string

String ...

func (*JSONTime) StringFormat

func (p *JSONTime) StringFormat(layout string) string

StringFormat 转换为固定格式字符串

func (*JSONTime) Time

func (p *JSONTime) Time() time.Time

Time ...

func (*JSONTime) ToDB

func (p *JSONTime) ToDB() (b []byte, err error)

ToDB ...

func (*JSONTime) UnmarshalJSON

func (p *JSONTime) UnmarshalJSON(data []byte) error

UnmarshalJSON ...

func (*JSONTime) Value

func (p *JSONTime) 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