maps

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get added in v0.5.47

func Get[T any](m map[string]interface{}, keys ...string) (T, bool)

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

func GetString(m map[string]interface{}, keys ...string) (string, bool)

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

func GlazedStructToMap(s interface{}) (map[string]interface{}, error)

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 StructToMap(i interface{}, lowerCaseKeys bool) map[string]interface{}

func StructToMapThroughYAML added in v0.5.4

func StructToMapThroughYAML(s interface{}) (map[string]interface{}, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL