Documentation ¶
Overview ¶
Package structs provides reflection utilities to inspect structures.
Index ¶
- func FieldExported(field *reflect.StructField, predicates ...ExportedPredicate) (exported bool)
- func FindField(pointerToAField interface{}, pointerToAStruct interface{}) (field *reflect.StructField, found bool)
- func ListExportedFields(val interface{}, predicates ...ExportedPredicate) []*reflect.StructField
- func ListExportedFieldsPtrs(val interface{}, predicates ...ExportedPredicate) (fields []*reflect.StructField, valPtrs []interface{})
- type ExportedPredicate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FieldExported ¶
func FieldExported(field *reflect.StructField, predicates ...ExportedPredicate) (exported bool)
FieldExported returns true if field name starts with uppercase
func FindField ¶
func FindField(pointerToAField interface{}, pointerToAStruct interface{}) (field *reflect.StructField, found bool)
FindField compares the pointers (pointerToAField with all fields in pointerToAStruct)
func ListExportedFields ¶
func ListExportedFields(val interface{}, predicates ...ExportedPredicate) []*reflect.StructField
ListExportedFields returns all fields of a structure that starts wit uppercase letter
func ListExportedFieldsPtrs ¶
func ListExportedFieldsPtrs(val interface{}, predicates ...ExportedPredicate) ( fields []*reflect.StructField, valPtrs []interface{})
ListExportedFieldsPtrs iterates struct fields and return slice of pointers to field values
Types ¶
type ExportedPredicate ¶
type ExportedPredicate func(field *reflect.StructField) bool
ExportedPredicate defines a callback (used in func FieldExported)
Click to show internal directories.
Click to hide internal directories.