Documentation
¶
Index ¶
- func Get[T any](m map[string]interface{}, keys ...string) (T, bool)
- func GetInteger[T cast.SignedInt | cast.UnsignedInt](m map[string]interface{}, keys ...string) (T, bool)
- func GetString(m map[string]interface{}, keys ...string) (string, bool)
- func GetValues[Key comparable, Value any](m map[Key]Value) []Value
- func GlazedStructToMap(s interface{}) (map[string]interface{}, error)
- func IsStructPointer(s interface{}) bool
- func StructToMap(i interface{}, lowerCaseKeys bool) map[string]interface{}
- func StructToMapThroughYAML(s interface{}) (map[string]interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶ added in v0.5.47
Get retrieves a nested value from a map using a sequence of keys. It safely handles missing keys or incorrect types at any level. Returns the value cast to type T and true if found and castable, otherwise the zero value of T and false.
func GetInteger ¶ added in v0.5.47
func GetInteger[T cast.SignedInt | cast.UnsignedInt](m map[string]interface{}, keys ...string) (T, bool)
GetInteger retrieves a nested integer value from a map. It handles potential numeric type mismatches (e.g., float64 from JSON) using cast helpers.
func GetString ¶ added in v0.5.47
GetString retrieves a nested string value from a map. It's a convenience wrapper around Get[string].
func GetValues ¶ added in v0.2.55
func GetValues[Key comparable, Value any](m map[Key]Value) []Value
func GlazedStructToMap ¶ added in v0.4.36
GlazedStructToMap converts a struct pointer to a map of parameter names to values. It iterates through the struct fields looking for the "glazed.parameter" tag. For each field with the tag, it will add an entry to the returned map with the tag value as the key and the field's value as the map value. Returns an error if s is not a pointer to a struct.
func IsStructPointer ¶ added in v0.4.30
func IsStructPointer(s interface{}) bool
func StructToMap ¶
func StructToMapThroughYAML ¶ added in v0.5.4
Types ¶
This section is empty.