Documentation ¶
Index ¶
- Variables
- func DeepFields(ifaceType reflect.Type) []reflect.StructField
- func JSONMarshalToString(v interface{}) string
- func MD5Hash(b []byte) string
- func MD5HashString(s string) string
- func SHA1Hash(b []byte) string
- func SHA1HashString(s string) string
- func StructCopy(DstStructPtr interface{}, SrcStructPtr interface{})
- func StructMapToStruct(s, ts interface{}) error
- type S
- func (s S) Bool() (bool, error)
- func (s S) Bytes() []byte
- func (s S) DefaultBool(defaultVal bool) bool
- func (s S) DefaultFloat32(defaultVal float32) float32
- func (s S) DefaultFloat64(defaultVal float64) float64
- func (s S) DefaultInt(defaultVal int) int
- func (s S) DefaultInt64(defaultVal int64) int64
- func (s S) DefaultUint(defaultVal uint) uint
- func (s S) DefaultUint64(defaultVal uint64) uint64
- func (s S) Float32() (float32, error)
- func (s S) Float64() (float64, error)
- func (s S) Int() (int, error)
- func (s S) Int64() (int64, error)
- func (s S) String() string
- func (s S) ToJSON(v interface{}) error
- func (s S) Uint() (uint, error)
- func (s S) Uint64() (uint64, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( JSONMarshal = json.Marshal JSONUnmarshal = json.Unmarshal JSONMarshalIndent = json.MarshalIndent JSONNewDecoder = json.NewDecoder JSONNewEncoder = json.NewEncoder )
定义JSON操作
View Source
var ( YAMLMarshal = yaml.Marshal YAMLUnmarshal = yaml.Unmarshal YAMLNewDecoder = yaml.NewDecoder YAMLNewEncoder = yaml.NewEncoder )
定义YAML操作
Functions ¶
func DeepFields ¶
func DeepFields(ifaceType reflect.Type) []reflect.StructField
func JSONMarshalToString ¶
func JSONMarshalToString(v interface{}) string
JSONMarshalToString JSON编码为字符串
func StructCopy ¶
func StructCopy(DstStructPtr interface{}, SrcStructPtr interface{})
Types ¶
type S ¶
type S string
S 字符串类型转换
func (S) DefaultBool ¶
DefaultBool 转换为bool,如果出现错误则使用默认值
func (S) DefaultFloat32 ¶
DefaultFloat32 转换为float32,如果出现错误则使用默认值
func (S) DefaultFloat64 ¶
DefaultFloat64 转换为float64,如果出现错误则使用默认值
func (S) DefaultInt64 ¶
DefaultInt64 转换为int64,如果出现错误则使用默认值
func (S) DefaultUint ¶
DefaultUint 转换为uint,如果出现错误则使用默认值
func (S) DefaultUint64 ¶
DefaultUint64 转换为uint64,如果出现错误则使用默认值
Click to show internal directories.
Click to hide internal directories.