ftime

package
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: MIT Imports: 7 Imported by: 38

Documentation

Index

Constants

View Source
const (
	// TIMESTAMP 时间戳展示
	TIMESTAMP = FormatType("timestamp")
	// TEXT 文本格式展示
	TEXT = FormatType("text")
)
View Source
const (
	// Length10 10位 精确到秒
	Length10 = TimestampLength(10)
	// Length13 13位 精确到毫秒
	Length13 = TimestampLength(13)
	// Length16 16位 精确到微妙
	Length16 = TimestampLength(16)
	// Length19 19位 精确到纳秒
	Length19 = TimestampLength(19)
)

Variables

View Source
var (
	// ErrUnKnownFormatType format type 不支持
	ErrUnKnownFormatType = errors.New("unknown format type error")
	// ErrUnKnownTimestampLength timestamp length 不支持
	ErrUnKnownTimestampLength = errors.New("unknown timestamp length error")
)
View Source
var (
	// UsedFormatType 当前时间展示的格式
	UsedFormatType = TIMESTAMP
	// UsedTimestampLength 当前使用的时间戳长度
	UsedTimestampLength = Length13
	// UsedTextTimeFormart 文本格式
	UsedTextTimeFormart = "2006-01-02 15:04:05"
)

Functions

This section is empty.

Types

type FormatType

type FormatType string

FormatType 时间输出的格式

type Time

type Time time.Time

Time 封装Time 主要用于序列化时控制输出格式

func Now

func Now() Time

Now 当前时间

func T

func T(t time.Time) Time

T 类型转换

func (Time) MarshalBSONValue

func (t Time) MarshalBSONValue() (bsontype.Type, []byte, error)

MarshalBSONValue implements the bson.ValueMarshaler interface.

func (Time) MarshalJSON

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

MarshalJSON 实现JSON 序列化接口

func (*Time) Scan

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

Scan 实现sql的反序列化

func (*Time) T

func (t *Time) T() time.Time

T 转化成标准时间对象

func (Time) Timestamp added in v0.3.6

func (t Time) Timestamp() int64

Timestamp 时间戳

func (*Time) UnmarshalBSONValue

func (t *Time) UnmarshalBSONValue(bt bsontype.Type, data []byte) error

UnmarshalBSONValue implements the bson.ValueUnmarshaler interface.

func (*Time) UnmarshalJSON

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

UnmarshalJSON 实现JSON 反序列化接口

func (Time) Value

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

Value 实现sql的序列化

type TimestampLength

type TimestampLength int

TimestampLength 时间戳长度

Jump to

Keyboard shortcuts

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