Documentation
¶
Index ¶
- func Cast2Bool(v interface{}) bool
- func Cast2Float32(v interface{}) float32
- func Cast2Float64(v interface{}) float64
- func Cast2Int(v interface{}) int
- func Cast2String(v interface{}) string
- func CastPrimitiveSlice(items []interface{}, t reflect.Kind) interface{}
- func CastPrimitiveSliceInplace(items *[]interface{}, t reflect.Kind)
- func CastPrimitiveValueInplace(item *interface{}, t reflect.Kind)
- func GetEnvOrDefault(k string, dv interface{}) interface{}
- func InterfaceHasNilValue(actual interface{}) bool
- func PanicError(err error)
- func ToBools(items []interface{}) []bool
- func ToFloat64s(items []interface{}) []float64
- func ToInt64s(items []interface{}) []int64
- func ToInts(items []interface{}) []int
- func ToStrings(items []interface{}) []string
- func TransferInterfaceLike(v unsafe.Pointer, dv interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cast2Float32 ¶
func Cast2Float32(v interface{}) float32
func Cast2Float64 ¶
func Cast2Float64(v interface{}) float64
func Cast2String ¶
func Cast2String(v interface{}) string
func CastPrimitiveSlice ¶
func CastPrimitiveValueInplace ¶
todo: support more type
func GetEnvOrDefault ¶
func GetEnvOrDefault(k string, dv interface{}) interface{}
k, env name for `os.LookupEnv` call dv, for default return value. some advices(or say notices) may be helpful: 1. if do not care default value, you can just pass `nil`, and the function's behavior is just like `os.GetEnv` 2. if you do known or do need that the type of returned value is specified, you can pass the `zero-value` of this type, like "" for string, 0 for int 3. if dv is not `nil`, and the env variable found, will cast the env variable from string type to dv's type
func InterfaceHasNilValue ¶
func InterfaceHasNilValue(actual interface{}) bool
func PanicError ¶
func PanicError(err error)
func ToFloat64s ¶
func ToFloat64s(items []interface{}) []float64
func TransferInterfaceLike ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.