Documentation
¶
Index ¶
- func FieldList(in interface{}) []string
- func FieldListNoSort(in interface{}) []string
- func FieldValue(path string, in interface{}) (v interface{}, found bool)
- func GetterList(in interface{}) []string
- func GetterValue(path string, in interface{}) (v interface{}, found bool)
- func SetFieldValue(path string, v interface{}, in interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FieldList ¶
func FieldList(in interface{}) []string
FieldList returns the list of fields of a struct, sorted.
func FieldListNoSort ¶ added in v1.1.1
func FieldListNoSort(in interface{}) []string
FieldListNoSort return the list of fields of a struct, recursively without sorting.
func FieldValue ¶
FieldValue returns a value of a field at path in deeply nested structs, will traverse both maps and structs.
func GetterList ¶
func GetterList(in interface{}) []string
GetterList returns list of getter methods that accept no arguments (except the implicit pointer to the struct) and return one value.
Example: (f *foo) Bar() string
func GetterValue ¶
GetterValue is a special case of FieldValue, that checks if for a field named Foo, there is a method that is named FooBytes(). Useful to avoid allocations when accesing string values that can be returned as a memory pointer instead (e.g. in capnproto).
func SetFieldValue ¶ added in v1.1.0
func SetFieldValue(path string, v interface{}, in interface{})
SetFieldValue sets a value of a field at path in deeply nested structs, will traverse both maps and structs.
Types ¶
This section is empty.