Documentation
¶
Overview ¶
Package reflect provides utilities for traversing struct fields and values during template evaluation, supporting both field names and JSON tags.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanDescend ¶
CanDescend returns true if v is a type that can have fields/elements accessed.
func PopulateStructFields ¶
PopulateStructFields adds exported struct fields to the map using JSON tags. Nested structs are converted to maps to support path resolution like item.inStock.
func ResolveValue ¶
ResolveValue traverses a value by field access (supporting nested structs, maps, slices). Field access can use either the struct field name or its JSON tag (if present). Returns (value, true) if resolution succeeds, (nil, false) otherwise.
func SliceToAny ¶ added in v0.0.7
SliceToAny converts any typed slice to []any. Returns nil if the input is not a slice.
func StructToMap ¶
StructToMap converts a struct to a map using JSON tags for keys. Nested structs are recursively converted to maps as well.
Types ¶
This section is empty.