Documentation ¶
Overview ¶
Package reflectKit Default将默认值应用于零值的struct字段。 本文件引用zzjcool/goutils项目,引用地址为:https://github.com/zzjcool/goutils/blob/main/defaults/defauls.go
Package reflectKit 主要用于生成一个Record ¶
Package reflectKit 反射工具包
Index ¶
- Constants
- func StructDefault(t interface{}) error
- func StructToMapSI(v interface{}) map[string]interface{}
- func StructToMapSS(body interface{}) map[string]string
- type ErrNotAStructPointer
- type ErrorUnsettable
- type ErrorUnsupportedType
- type Record
- type Ret
- func (r *Ret) By(key string, value interface{}) *Ret
- func (r *Ret) Delete(key string) *Ret
- func (r *Ret) Fail() *Ret
- func (r *Ret) Get(key string) interface{}
- func (r *Ret) IsOk() bool
- func (r *Ret) Ok() *Ret
- func (r *Ret) Set(key string, value interface{}) *Ret
- func (r *Ret) ToJSON() (string, error)
Constants ¶
View Source
const ( StateOk = true StateFail = false )
Variables ¶
This section is empty.
Functions ¶
func StructDefault ¶
func StructDefault(t interface{}) error
StructDefault 给结构体增加默认值 *
- @param t 结构体
- @return 返回错误信息
func StructToMapSI ¶ added in v0.0.8
func StructToMapSI(v interface{}) map[string]interface{}
StructToMapSI 结构体转换为map[string]interface *
- @param body 待转换的结构体
- @return map[string]interface
func StructToMapSS ¶ added in v0.0.8
StructToMapSS 结构体转换为map[string]string *
- @param body 待转换的结构体
- @return map[string]string
Types ¶
type ErrorUnsupportedType ¶
type ErrorUnsupportedType struct {
// contains filtered or unexported fields
}
ErrorUnsupportedType 指示结构字段的类型还不是此包中的支持
type Record ¶
type Record struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.