Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct { Name string // the field's original name // but if a tag with `name: "other"` // exist then this fill is filled, otherwise it's the same as the Name. TagName string Index int Type reflect.Type Value reflect.Value // contains filtered or unexported fields }
Field is a controller's field contains all the necessary, internal, information to work with.
func LookupFields ¶
func LookupFields(elem reflect.Type, matcher func(reflect.StructField) bool, handler func(*Field)) (fields []Field)
LookupFields iterates all "elem"'s fields and its fields if structs, recursively. Compares them to the "matcher", if they passed then it executes the "handler" if any, the handler can change the field as it wants to.
It finally returns that collection of the valid fields, can be empty.
func (Field) GetFullName ¶
GetFullName returns the full name of that field i.e: UserController.SessionController.Manager, it's useful for debugging only.
func (Field) GetIndex ¶
GetIndex returns all the "dimensions" of the controller struct field's position that this field is referring to, recursively. Usage: elem.FieldByIndex(field.getIndex()) for example the {0,1} means that the field is on the second field of the first's field of this struct.
func (Field) GetTagName ¶
GetTagName returns the tag name of the referring field recursively.