Documentation ¶
Overview ¶
* @Author: wei-g @Date: 2020/11/25 3:01 下午 @Description: 简化时间序列化操作等有关处理
本文件部分代码实现借鉴 https://www.liwenzhou.com/posts/Go/json_tricks_in_go/#autoid-0-0-12
Index ¶
Constants ¶
View Source
const ( SecondTimeLayout = "2006-01-02 15:04:05 MST" // 精确到秒,带时区信息 //TimeLayoutNano = "2006-01-02 15:04:05.000000000 MST" // 精确到毫秒,带时区信息 ValidatorSecondTimeTag = "formatSecondTime" // validator 注册 字段基本的tag名 )
Variables ¶
This section is empty.
Functions ¶
func CheckSecondTimeFunc ¶ added in v0.3.4
func CheckSecondTimeFunc(fl validator.FieldLevel) bool
Types ¶
type SecondTime ¶
SecondTime 精确到秒的时间序列化
func Parse ¶ added in v0.3.4
func Parse(value string) (secondTime SecondTime, err error)
Parse parses a formatted string and returns the time value it represents.
func (*SecondTime) MarshalJSON ¶
func (s *SecondTime) MarshalJSON() (data []byte, err error)
MarshalJSON json 序列化接口
func (*SecondTime) UnmarshalJSON ¶
func (s *SecondTime) UnmarshalJSON(b []byte) (err error)
UnmarshalJSON json 反序列化接口
Click to show internal directories.
Click to hide internal directories.