Documentation ¶
Index ¶
- func AtoiSlice(numbers []int) []string
- func GetKeys[T MapKey, V any](data map[T]V) []T
- func GetValues[K MapKey, V any](data map[K]V) []V
- func IsNil(i interface{}) bool
- func Round(f float64, n int) float64
- func ToBoolean(v interface{}) bool
- func ToInt(v interface{}) int
- func ToInt64(v interface{}) int64
- func ToMap(v interface{}) (map[string]interface{}, error)
- func ToMaps(v interface{}) ([]map[string]interface{}, error)
- func ToNumber(v interface{}) float64
- func ToString(value interface{}) string
- func ToStringWithDefault(value interface{}, def string) string
- type MapKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToMap ¶
ToMap 将interface转换为map. 如果参数是字符串,则尝试进行json反序列化. 如果参数是interface{}/map[string]interface{}数组,则将数组第一个元素进行转换. 如果参数是其他类型,则先调用json进行序列化,再把结果进行反序列化.
func ToStringWithDefault ¶
Types ¶
type MapKey ¶
type MapKey interface { constraints.Ordered | ~bool }
Click to show internal directories.
Click to hide internal directories.