Documentation ¶
Overview ¶
------------------------------------------------------------------------------ 类型转换函数集 ------------------------------------------------------------------------------
Index ¶
- func BoolToFloat(v bool) float64
- func BoolToInt(v bool) int
- func IsEmpty(a interface{}) bool
- func IsEmpty2(a interface{}, falseAsEmpty ...bool) bool
- func MustStrToStringMap(str string) map[string]string
- func SetDefaultJsonApi(api JsonAPI)
- func StrToBool(s string) (bool, error)
- func StrToBoolNoError(s string) bool
- func StrToFloat(s string) (float64, error)
- func StrToFloatNoError(s string) float64
- func StrToInt(s string) (int, error)
- func StrToInt32(s string) (int32, error)
- func StrToInt32NoError(s string) int32
- func StrToInt64(s string) (int64, error)
- func StrToInt64NoError(s string) int64
- func StrToIntNoError(s string) int
- func StrToStringMap(str string) (map[string]string, error)
- func StrToStringObjectMap(str string) (map[string]interface{}, error)
- func StrToUint(s string) (uint, error)
- func StrToUint32(s string) (uint32, error)
- func StrToUint32NoError(s string) uint32
- func StrToUint64(s string) (uint64, error)
- func StrToUint64NoError(s string) uint64
- func StrToUintNoError(s string) uint
- func ToBool(a interface{}) (bool, error)
- func ToBoolNoError(a interface{}) bool
- func ToError(a interface{}) (err error)
- func ToFloat(a interface{}) (float64, error)
- func ToFloat32(a interface{}) (float32, error)
- func ToFloat32NoError(a interface{}) float32
- func ToFloatNoError(a interface{}) float64
- func ToInt(a interface{}) (int, error)
- func ToInt32(a interface{}) (int32, error)
- func ToInt32NoError(a interface{}) int32
- func ToInt64(a interface{}) (int64, error)
- func ToInt64NoError(a interface{}) int64
- func ToIntNoError(a interface{}) int
- func ToString(a interface{}, api ...JsonAPI) (string, error)
- func ToStringMap(a interface{}, api ...JsonAPI) (map[string]string, error)
- func ToStringMapNoError(a interface{}, api ...JsonAPI) map[string]string
- func ToStringNoError(a interface{}, api ...JsonAPI) string
- func ToStringObjectMap(a interface{}, api ...JsonAPI) (map[string]interface{}, error)
- func ToStringObjectMapNoError(a interface{}, api ...JsonAPI) map[string]interface{}
- func ToUint(a interface{}) (uint, error)
- func ToUint32(a interface{}) (uint32, error)
- func ToUint32NoError(a interface{}) uint32
- func ToUint64(a interface{}) (uint64, error)
- func ToUint64NoError(a interface{}) uint64
- func ToUintNoError(a interface{}) uint
- type BasicType
- func GetBasicType(a interface{}, parseStrValue ...bool) (BasicType, reflect.Type, reflect.Value)
- func GetBasicType0(a interface{}, parseStrValue ...bool) BasicType
- func GetStrValueType(str string) (BasicType, reflect.Type, reflect.Value, interface{})
- func ReflectTypeToBasicType(refType reflect.Type) BasicType
- type ConvertToString
- type JsonAPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolToFloat ¶
func MustStrToStringMap ¶
func SetDefaultJsonApi ¶
func SetDefaultJsonApi(api JsonAPI)
func StrToBoolNoError ¶
func StrToFloat ¶
func StrToFloatNoError ¶
func StrToInt32 ¶
func StrToInt32NoError ¶
func StrToInt64 ¶
func StrToInt64NoError ¶
func StrToIntNoError ¶
func StrToStringObjectMap ¶
func StrToUint32 ¶
func StrToUint32NoError ¶
func StrToUint64 ¶
func StrToUint64NoError ¶
func StrToUintNoError ¶
func ToBoolNoError ¶
func ToBoolNoError(a interface{}) bool
func ToFloat32NoError ¶
func ToFloat32NoError(a interface{}) float32
func ToFloatNoError ¶
func ToFloatNoError(a interface{}) float64
func ToInt32NoError ¶
func ToInt32NoError(a interface{}) int32
func ToInt64NoError ¶
func ToInt64NoError(a interface{}) int64
func ToIntNoError ¶
func ToIntNoError(a interface{}) int
func ToStringMapNoError ¶
func ToStringNoError ¶
func ToStringObjectMap ¶
func ToUint32NoError ¶
func ToUint32NoError(a interface{}) uint32
func ToUint64NoError ¶
func ToUint64NoError(a interface{}) uint64
func ToUintNoError ¶
func ToUintNoError(a interface{}) uint
Types ¶
type BasicType ¶
type BasicType int
BasicType 简化版的反射类型
const ( BasicType_Others BasicType = -1 BasicType_Invalid BasicType = 0 BasicType_Nil BasicType = 1 BasicType_Bool BasicType = 2 BasicType_Int BasicType = 3 BasicType_Uint BasicType = 4 BasicType_Float BasicType = 5 BasicType_String BasicType = 6 BasicType_Slice BasicType = 7 BasicType_Map BasicType = 8 BasicType_Struct BasicType = 9 )
func GetBasicType ¶
获取变量的基本类型
parseStrValue: 如果 a 是字符串,是否继续解析字符串内容的值类型(使用了 GetStrValueType 方法)。例: GetBasicType("123", true) 将返回 BasicType_Int、GetBasicType("true", true) 将返回 BasicType_Bool。
func GetBasicType0 ¶
func GetStrValueType ¶
获取字符串值的格式。
BasicType: 返回字符串可能的基础类型。可能是以下值: String: 普通字符串 Float: 带有小数点的数字 Int: 负整数、或小于等于 MaxInt64 的非负整数 Uint: 非负且大于 MaxInt64 的整数 Bool: "bool" 或者 "false" Nil: "null" Slice: JSON 数组 Map: JSON 对象
func ReflectTypeToBasicType ¶
type ConvertToString ¶
Click to show internal directories.
Click to hide internal directories.