Documentation
¶
Index ¶
- func CompareAndCopyMaps(src, tgt map[string]any) map[string]any
- func DeepCopyMap(original map[string]any) map[string]any
- func GenerateRandomSerial(length int) string
- func JSONStringToMap(n string, s string) map[string]any
- func MapToJSONString(m map[string]any) string
- func StringToMap(s string) map[string]any
- func StructToMap(obj any) map[string]any
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareAndCopyMaps ¶
CompareAndCopyMaps compares two map[string]any for deep equality. If they are different, it returns a deep copy of the first map. If they are the same, it returns nil.
func DeepCopyMap ¶
DeepCopyMap creates a deep copy of a map[string]any, handling nested maps, slices, and other complex types recursively.
func GenerateRandomSerial ¶
GenerateRandomSerial generates a random serial number of specified length
func JSONStringToMap ¶
JSONStringToMap tries to parse a JSON string `s` into a map. If parsing fails, it returns a map with the original string as a value uder key `n`
func MapToJSONString ¶
MapToJSONString converts a map to its JSON string representation. Returns empty string if marshaling fails.
func StringToMap ¶
StringToMap tries to parse a string `s` into a map. If parsing fails, it returns nil.
func StructToMap ¶
StructToMap converts a struct to a map[string]any using reflection. It handles nested structs recursively and respects json tags and returns empty map for non-struct inputs
Types ¶
This section is empty.