Documentation ¶
Index ¶
- func CastFloatInterfaceToFloat[To FloatNumber](i interface{}) (To, bool)
- func CastInterfaceListToFloatList[To FloatNumber](list []interface{}) ([]To, bool)
- func CastInterfaceListToIntList[To SignedInt | UnsignedInt](list []interface{}) ([]To, bool)
- func CastInterfaceToFloatList[To FloatNumber](i interface{}) ([]To, bool)
- func CastInterfaceToIntList[To SignedInt | UnsignedInt](i interface{}) ([]To, bool)
- func CastInterfaceToStringMap[To any, From any](m interface{}) (map[string]To, bool)
- func CastList[To any, From any](list []From) ([]To, bool)
- func CastList2[To any, From any](list interface{}) ([]To, bool)
- func CastListToFloatList2[To FloatNumber](list interface{}) ([]To, bool)
- func CastListToIntList2[To SignedInt | UnsignedInt](list interface{}) ([]To, bool)
- func CastListToInterfaceList(value interface{}) ([]interface{}, error)
- func CastMapMember[To any](m map[string]interface{}, k string) (*To, bool)
- func CastMapToInterfaceMap[From any](m map[string]From) map[string]interface{}
- func CastNumberInterfaceToFloat[To FloatNumber](i interface{}) (To, bool)
- func CastNumberInterfaceToInt[To SignedInt | UnsignedInt](i interface{}) (To, bool)
- func CastStringMap[To any, From any](m map[string]From) (map[string]To, bool)
- func CastStringMap2[To any, From any](m interface{}) (map[string]To, bool)
- func CastToNumberList[To Number, From Number](list []From) ([]To, bool)
- func ConvertMapToInterfaceMap(input interface{}) (map[string]interface{}, error)
- func GetAndCast[T any](ps map[string]interface{}, name string, default_ T) (T, bool, error)
- func GetAndCastPtr[T any](ps map[string]interface{}, name string, default_ *T) (*T, bool, error)
- func InterfaceAddr[T any](t T) *interface{}
- type FloatNumber
- type Number
- type SignedInt
- type UnsignedInt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CastFloatInterfaceToFloat ¶
func CastFloatInterfaceToFloat[To FloatNumber](i interface{}) (To, bool)
func CastInterfaceListToFloatList ¶
func CastInterfaceListToFloatList[To FloatNumber](list []interface{}) ([]To, bool)
func CastInterfaceListToIntList ¶
func CastInterfaceListToIntList[To SignedInt | UnsignedInt](list []interface{}) ([]To, bool)
func CastInterfaceToFloatList ¶
func CastInterfaceToFloatList[To FloatNumber](i interface{}) ([]To, bool)
func CastInterfaceToIntList ¶
func CastInterfaceToIntList[To SignedInt | UnsignedInt](i interface{}) ([]To, bool)
func CastList ¶
CastList casts a list of From objects to To, by casting it to an interface{} in between.
func CastList2 ¶
CastList2 attempts even harder to cast a list of From object to To, by checking if we might be dealing with a list masquerading as a interface{}, then a []interface{}, before checking for []To.
func CastListToFloatList2 ¶ added in v0.2.56
func CastListToFloatList2[To FloatNumber](list interface{}) ([]To, bool)
func CastListToIntList2 ¶ added in v0.2.56
func CastListToIntList2[To SignedInt | UnsignedInt](list interface{}) ([]To, bool)
func CastListToInterfaceList ¶ added in v0.4.10
func CastListToInterfaceList(value interface{}) ([]interface{}, error)
CastListToInterfaceList attempts to convert the given value to a list of interface{}.
The function checks if the provided value is a slice or an array. If so, it returns a slice of interface{}, where each item in the original slice or array is converted to its interface{} representation.
func CastMapToInterfaceMap ¶
func CastNumberInterfaceToFloat ¶
func CastNumberInterfaceToFloat[To FloatNumber](i interface{}) (To, bool)
func CastNumberInterfaceToInt ¶ added in v0.2.56
func CastNumberInterfaceToInt[To SignedInt | UnsignedInt](i interface{}) (To, bool)
func CastStringMap2 ¶ added in v0.2.53
func CastToNumberList ¶
CastToNumberList casts a list of From objects to To. This is useful for transform between different int types, for example.
func ConvertMapToInterfaceMap ¶ added in v0.4.36
func GetAndCast ¶ added in v0.4.18
func GetAndCastPtr ¶ added in v0.4.18
func InterfaceAddr ¶ added in v0.4.36
func InterfaceAddr[T any](t T) *interface{}