Documentation
¶
Index ¶
- Constants
- func DecodeFloat64(value any) (any, error)
- func DecodeInt64(value any) (any, error)
- func DecodeString(value any) (any, error)
- func DecodeTime(value any) (any, error)
- func ToFloat64(value any) (*float64, error)
- func ToInt64(value any) (*int64, error)
- func ToString(value any) *string
- func ToTime(value any) (*time.Time, error)
- type Float64
- func (i *Float64) GetValue() *float64
- func (i Float64) IsExists() bool
- func (i Float64) IsExistsAndNotNull() bool
- func (i Float64) IsExistsAndNull() bool
- func (i Float64) IsZero() bool
- func (f Float64) MarshalJSON() ([]byte, error)
- func (f *Float64) Scan(value any) error
- func (i *Float64) SetNull() *Float64
- func (i *Float64) SetValue(value float64) *Float64
- func (f Float64) String() string
- func (i *Float64) UnmarshalJSON(data []byte) error
- func (i *Float64) UnmarshalParam(param string) error
- func (i *Float64) UnmarshalText(text []byte) error
- func (f Float64) Value() (driver.Value, error)
- func (i *Float64) ValueOr(v float64) float64
- func (i *Float64) ValueOrZero() float64
- type Int64
- func (i *Int64) GetValue() *int64
- func (i Int64) IsExists() bool
- func (i Int64) IsExistsAndNotNull() bool
- func (i Int64) IsExistsAndNull() bool
- func (i Int64) IsZero() bool
- func (i Int64) MarshalJSON() ([]byte, error)
- func (i *Int64) Scan(value any) error
- func (i *Int64) SetNull()
- func (i *Int64) SetValue(value int64)
- func (i Int64) String() string
- func (i *Int64) UnmarshalJSON(data []byte) error
- func (i *Int64) UnmarshalParam(param string) error
- func (i *Int64) UnmarshalText(text []byte) error
- func (i Int64) Value() (driver.Value, error)
- func (i *Int64) ValueOr(v int64) int64
- func (i *Int64) ValueOrZero() int64
- type String
- func (i *String) GetValue() *string
- func (i String) IsExists() bool
- func (i String) IsExistsAndNotNull() bool
- func (i String) IsExistsAndNull() bool
- func (i String) IsZero() bool
- func (i String) MarshalJSON() ([]byte, error)
- func (i *String) Scan(value any) error
- func (i *String) SetNull()
- func (i *String) SetValue(value string)
- func (i String) String() string
- func (i *String) UnmarshalJSON(data []byte) error
- func (i *String) UnmarshalParam(param string) error
- func (i *String) UnmarshalText(text []byte) error
- func (i String) Value() (driver.Value, error)
- func (i *String) ValueOr(v string) string
- func (i *String) ValueOrZero() string
- type Time
- func (i *Time) GetValue() *time.Time
- func (i Time) IsExists() bool
- func (i Time) IsExistsAndNotNull() bool
- func (i Time) IsExistsAndNull() bool
- func (i Time) IsZero() bool
- func (t Time) MarshalJSON() ([]byte, error)
- func (t *Time) Scan(value any) error
- func (i *Time) SetNull()
- func (i *Time) SetValue(value time.Time)
- func (t Time) String() string
- func (t *Time) UnmarshalJSON(bs []byte) error
- func (i *Time) UnmarshalParam(param string) error
- func (i *Time) UnmarshalText(text []byte) error
- func (t Time) Value() (driver.Value, error)
- func (i *Time) ValueOr(v time.Time) time.Time
- func (i *Time) ValueOrZero() time.Time
Constants ¶
const ( // DateFormat 日期格式 DateFormat = "2006-01-02" // TimeFormat 时间格式 TimeFormat = "2006-01-02 15:04:05" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Float64 ¶
Float64 支持前端传递null,int,float,string类型和不传值 前端传1,"1"都可以,都转换为float64类型: Float64{Val: 1.0, Exist: true} 前端null值: Float64{Val: nil, Exist: true} 前端""值: Float64{Val: nil, Exist: true} 前端没传值: Float64{Val: nil, Exist: false}
func (Float64) IsExistsAndNotNull ¶
IsExistsAndNotNull 存在且不为null
func (*Float64) UnmarshalJSON ¶
UnmarshalJSON 实现json反序列化接口
func (*Float64) UnmarshalParam ¶
UnmarshalParam 实现gin框架的参数绑定接口
func (*Float64) UnmarshalText ¶
UnmarshalText 实现 encoding.TextUnmarshaler 接口
type Int64 ¶
Int64 支持前端传递null,int,string类型和不传值 前端传1,"1"都可以,都转换为int64类型: Int64{Val: 1, Exist: true} 前端null值: Int64{Val: nil, Exist: true} 前端""值: Int64{Val: nil, Exist: true} 前端没传值: Int64{Val: nil, Exist: false}:结构体字段都是零值,并且Value接口返回nil,会忽略更新
func (Int64) IsExistsAndNotNull ¶
IsExistsAndNotNull 存在且不为null
func (*Int64) UnmarshalJSON ¶
UnmarshalJSON 实现json反序列化接口,支持 int64, string,null类型,对于float64类型,判断转换前后是否相等,防止精度丢失
func (*Int64) UnmarshalParam ¶
UnmarshalParam 实现gin框架的参数绑定接口
func (*Int64) UnmarshalText ¶
UnmarshalText 实现 encoding.TextUnmarshaler 接口
type String ¶
String 支持前端传递null,int,string类型和不传值 前端传1,"1"都可以,都转换为string类型: String{Val: "1", Exist: true} 前端null值: String{Val: nil, Exist: true} 前端""值: String{Val: "", Exist: true} 前端没传值: String{Val: nil, Exist: false}
func (String) IsExistsAndNotNull ¶
IsExistsAndNotNull 存在且不为null
func (*String) UnmarshalJSON ¶
UnmarshalJSON 实现json反序列化接口
func (*String) UnmarshalParam ¶
UnmarshalParam 实现gin框架的参数绑定接口
func (*String) UnmarshalText ¶
UnmarshalText 实现 encoding.TextUnmarshaler 接口
type Time ¶
Time 自定义时间格式
func (Time) IsExistsAndNotNull ¶
IsExistsAndNotNull 存在且不为null
func (Time) MarshalJSON ¶
MarshalJSON 将Time类型的时间转化为JSON字符串格式
func (*Time) UnmarshalJSON ¶
UnmarshalJSON 实现json反序列化接口
func (*Time) UnmarshalParam ¶
UnmarshalParam 实现gin框架的参数绑定接口
func (*Time) UnmarshalText ¶
UnmarshalText 实现 encoding.TextUnmarshaler 接口