Documentation
¶
Overview ¶
Package reflection provides utilities for struct field inspection, tag extraction, and dynamic method introspection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFieldTypes ¶
GetFieldTypes returns a map of field names to their types. For nested structs, the value is a map[string]any containing the nested struct's fields.
func GetMethodName ¶
GetMethodName is meant to fetch the name of a given method passed in as an argument.
func GetTagNameByValue ¶
GetTagNameByValue searches struct s (or *s) for a field whose value equals fieldValue and returns the tag for tagKey (e.g. "json") for the first match. It returns an error if s is not a struct or no matching field is found.
Notes & limitations: - It compares field values using reflect.DeepEqual. - Unexported fields are skipped (fv.CanInterface() == false). - If multiple fields have identical values, the first match is returned (search order is struct field order). - This requires passing the originating struct instance; a bare field value alone is insufficient in Go.
Types ¶
This section is empty.