Documentation
¶
Index ¶
- func ChildMapsToStringKey(convertMap map[string]interface{}) map[string]interface{}
- func DecodeStruct[T any](base64str string, template interface{}) (T, error)
- func EncodeStruct(obj interface{}) (string, error)
- func GenericMapToStruct(convertMap map[interface{}]interface{}, thing interface{}) error
- func MapToStruct(convertMap map[string]interface{}, convertTo interface{}) error
- func MapToStructEx(convertMap map[string]interface{}, convertTo interface{}) error
- func SimpleStructToMap(something interface{}) (map[string]interface{}, error)
- func ToArray(s interface{}) []interface{}
- func ToArrayWithTag(s interface{}, tagType string) (result []interface{})
- func ToBool(input interface{}) (result bool, err error)
- func ToFloat64(input interface{}) (result float64, err error)
- func ToInt(input interface{}) (result int, err error)
- func ToInt32(input interface{}) (result int32, err error)
- func ToInt64(input interface{}) (result int64, err error)
- func ToMap(s interface{}) (result map[string]interface{})
- func ToMapWithStringKey(convertMap map[interface{}]interface{}) map[string]interface{}
- func ToMapWithTag(s interface{}, tagType string) map[string]interface{}
- func ToString(input interface{}) (result string, err error)
- type MapConverter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChildMapsToStringKey ¶
ChildMapsToStringKey converts a map[interface{}]interface{} to map[string]interface{} recursively, assuming that the input map key values are explicitly of type string
func DecodeStruct ¶
DecodeStruct decodes a base64 encoded JSON struct representation to an instance of T
Notes template should be of type T template should be a pointer to a struct that is T (but not strictly *T, which is why it is typed as interface{})
func EncodeStruct ¶
EncodeStruct converts a struct to JSON and Base64 encodes it
func GenericMapToStruct ¶
func GenericMapToStruct(convertMap map[interface{}]interface{}, thing interface{}) error
GenericMapToStruct converts a map into a struct via Json Marshal/Unmarshal
func MapToStruct ¶
MapToStruct converts a map into a struct via Json Marshal/Unmarshal
func MapToStructEx ¶
MapToStructEx converts a map into a struct via Json Marshal/Unmarshal and converts any child maps of type map[interface{}]interface{} to map[string]interface{}
func SimpleStructToMap ¶
SimpleStructToMap Converts a struct to a map via JSON Marshalling
func ToArrayWithTag ¶
func ToArrayWithTag(s interface{}, tagType string) (result []interface{})
func ToMapWithStringKey ¶
func ToMapWithStringKey(convertMap map[interface{}]interface{}) map[string]interface{}
ToMapWithStringKey converts a map[interface{}]interface{} to map[string]interface{} recursively, assuming that the input map key values are explicitly of type string
func ToMapWithTag ¶
Types ¶
type MapConverter ¶
MapConverter is an interface that allows a struct type to specify a custom conversion of the struct instance to a map representation