Documentation ¶
Index ¶
- Constants
- Variables
- type FormatType
- type Time
- func (t Time) MarshalBSONValue() (bsontype.Type, []byte, error)
- func (t Time) MarshalJSON() ([]byte, error)
- func (t *Time) Scan(value interface{}) error
- func (t *Time) T() time.Time
- func (t *Time) UnmarshalBSONValue(bt bsontype.Type, data []byte) error
- func (t *Time) UnmarshalJSON(b []byte) error
- func (t Time) Value() (driver.Value, error)
- type TimestampLength
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 Time ¶
Time 封装Time 主要用于序列化时控制输出格式
func (Time) MarshalBSONValue ¶
MarshalBSONValue implements the bson.ValueMarshaler interface.
func (*Time) UnmarshalBSONValue ¶
UnmarshalBSONValue implements the bson.ValueUnmarshaler interface.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON 实现JSON 反序列化接口
Click to show internal directories.
Click to hide internal directories.