Documentation
¶
Index ¶
- func FieldNames[T any](structInstance T, structTags ...string) []string
- func Fields[T any](structInstance T) []string
- func ForEach[T any](structInstance T, function func(key string, value any, tag reflect.StructTag))
- func GetField[T any](structInstance T, fieldName string) (any, bool)
- func HasField[T any](structInstance T, fieldName string) bool
- func ToMap[T any](structInstance T, structTags ...string) map[string]any
- func Values[T any](structInstance T) []any
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FieldNames ¶ added in v1.9.0
FieldNames returns field names, optionally using struct tags for naming. If struct tags are provided, uses the first matching tag value as the field name. Omits fields with tag value "-".
func ForEach ¶
ForEach given a struct, calls the passed in function with each visible struct field's name, value and tag.
func GetField ¶ added in v1.9.0
GetField retrieves the value of a field by name. Returns the value and true if found, zero value and false if not found.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.