Documentation ¶
Overview ¶
Package gconv implements powerful and easy-to-use converting functionality for any types of variables.
类型转换, 内部使用了bytes作为底层转换类型,效率很高。
Index ¶
- func Bool(i interface{}) bool
- func Bytes(i interface{}) []byte
- func Convert(i interface{}, t string, extraParams ...interface{}) interface{}
- func Float32(i interface{}) float32
- func Float64(i interface{}) float64
- func Floats(i interface{}) []float64
- func GTime(i interface{}, format ...string) *gtime.Time
- func Int(i interface{}) int
- func Int16(i interface{}) int16
- func Int32(i interface{}) int32
- func Int64(i interface{}) int64
- func Int8(i interface{}) int8
- func Interfaces(i interface{}) []interface{}
- func Ints(i interface{}) []int
- func Map(i interface{}, noTagCheck ...bool) map[string]interface{}
- func String(i interface{}) string
- func Strings(i interface{}) []string
- func Struct(params interface{}, objPointer interface{}, attrMapping ...map[string]string) error
- func Time(i interface{}, format ...string) time.Time
- func TimeDuration(i interface{}) time.Duration
- func Uint(i interface{}) uint
- func Uint16(i interface{}) uint16
- func Uint32(i interface{}) uint32
- func Uint64(i interface{}) uint64
- func Uint8(i interface{}) uint8
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Convert ¶
func Convert(i interface{}, t string, extraParams ...interface{}) interface{}
将变量i转换为字符串指定的类型t,非必须参数extraParams用以额外的参数传递
func Map ¶ added in v1.2.11
任意类型转换为 map[string]interface{} 类型, 如果给定的输入参数i不是map类型,那么转换会失败,返回nil. 当i为struct对象时,第二个参数noTagCheck表示不检测json标签,否则将会使用json tag作为map的键名。
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.