Documentation
¶
Index ¶
- Constants
- type ExBool
- type ExInt64
- type ExString
- type ExStringSlice
- type IgnoreError
- type JSON
- type JSONObject
- type Time
- func (t Time) GetDefault(context.Context, interface{}) interface{}
- func (t Time) GetDefaultPrepare(rt reflect.Type, value string) (interface{}, error)
- func (t Time) MarshalJSON() ([]byte, error)
- func (t *Time) Scan(value interface{}) error
- func (t *Time) UnmarshalJSON(data []byte) error
- func (t *Time) UnmarshalString(data string) error
- func (t Time) Value() (driver.Value, error)
- type Timestamp
- func (t Timestamp) GetDefault(context.Context, interface{}) interface{}
- func (t Timestamp) GetDefaultPrepare(rt reflect.Type, value string) (interface{}, error)
- func (t Timestamp) MarshalJSON() ([]byte, error)
- func (t *Timestamp) Scan(value interface{}) error
- func (t *Timestamp) UnmarshalJSON(data []byte) error
- func (t *Timestamp) UnmarshalString(data string) error
- func (t Timestamp) Value() (driver.Value, error)
Constants ¶
const (
TimeFormat string = "2006-01-02 15:04:05"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExBool ¶
type ExBool bool
ExBool bool 类型
支持值形式如: "true", 1, true, false, null
若是数字,只支持 0( 包含 "0") 和 1 ( 包含 "1"),若传入数字 2 或者其他值,将报错
func (ExBool) MarshalJSON ¶
MarshalJSON to "true", "false"
func (*ExBool) UnmarshalJSON ¶
UnmarshalJSON for ExString,
type ExInt64 ¶
type ExInt64 int64
ExInt64 扩展的 int64 类型
支持值形式如: 12345, "12345", false(解析为 0), null(解析为 0), "12345.1", "12345.0", 12345.1
"" 空字符串解析为 0 true 解析为 1
func (*ExInt64) UnmarshalJSON ¶
UnmarshalJSON for ExInt64
type ExString ¶
type ExString string
ExString 字符串类型
支持值形式如:"abcde", 12345, true, false, null 若传入为 bool 类型,会获的其字符串形式的值:"true"、"false" 若传入的是 null,会获得其字符串形式的值:"null" 若传入的是数字,如 123,会获的其字符串形式的值: "123"
func (*ExString) UnmarshalJSON ¶
UnmarshalJSON for ExString
type ExStringSlice ¶
type ExStringSlice []string
ExStringSlice 扩展 json 数组类型, 允许格式:"abc"、["avc","def"]、"abc,def"、null、"1,2"、["1","2"]
若字段定义为该类型,在 json.Marshal 的时候,当值为空的时候会编码为 null。
func (*ExStringSlice) StringSlice ¶
func (s *ExStringSlice) StringSlice() []string
StringSlice 返回 []string 的值
func (*ExStringSlice) UnmarshalJSON ¶
func (s *ExStringSlice) UnmarshalJSON(b []byte) error
UnmarshalJSON implement json interface
type IgnoreError ¶
type IgnoreError struct{}
func (IgnoreError) Error ¶
func (ie IgnoreError) Error() string
type JSON ¶
type JSON json.RawMessage
func (JSON) MarshalJSON ¶
MarshalJSON Struct 转 Json 数据结构
func (*JSON) UnmarshalJSON ¶
UnmarshalJSON Json 转 Struct 数据结构
func (*JSON) UnmarshalString ¶
UnmarshalString string 转 Struct 数据结构
type JSONObject ¶
type JSONObject map[string]interface{}
func (JSONObject) MarshalJSON ¶
func (j JSONObject) MarshalJSON() ([]byte, error)
MarshalJSON Struct 转 Json 数据结构
func (*JSONObject) UnmarshalJSON ¶
func (j *JSONObject) UnmarshalJSON(data []byte) error
UnmarshalJSON 反序列化
func (*JSONObject) UnmarshalString ¶
func (j *JSONObject) UnmarshalString(data string) error
UnmarshalString string 转 Struct 数据结构
type Time ¶
func (Time) GetDefault ¶
GetDefault 获取当前时间,只有这一种可能
func (Time) GetDefaultPrepare ¶
GetDefaultPrepare 确定是否合法的default,不是交由后续处理
func (Time) MarshalJSON ¶
MarshalJSON Struct 转 Json 数据结构 格式成符合预期的时间格式字符串后返回,效果与Value一样
func (*Time) UnmarshalJSON ¶
UnmarshalJSON Json 转 Struct 数据结构
func (*Time) UnmarshalString ¶
UnmarshalString string 转 Struct 数据结构
type Timestamp ¶
func (Timestamp) GetDefault ¶
GetDefault 获取当前时间,只有这一种可能
func (Timestamp) GetDefaultPrepare ¶
GetDefaultPrepare 确定是否合法的default,不是交由后续处理
func (Timestamp) MarshalJSON ¶
MarshalJSON Struct 转 Json 数据结构 格式成符合预期的时间格式字符串后返回,效果与Value一样
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON Json 转 Struct 数据结构
func (*Timestamp) UnmarshalString ¶
UnmarshalString string 转 Struct 数据结构