Documentation ¶
Index ¶
- func GetType(t reflect.Type, path string) (reflect.Type, error)
- func GetValue(data interface{}, path string) (interface{}, error)
- func IsNil(value reflect.Value) bool
- func ListFields(t reflect.Type) []string
- func ListFieldsWithFilter(t reflect.Type, filter ListFieldFilter) []string
- type ListFieldFilter
- type NilValueError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetType ¶
GetType will extract the type at the given path from the data Go struct E.g data = { Friends: []Friend{ { Name: "John" } }, path = "Friends.0.Name" will return "John"
func GetValue ¶
GetValue will extract the value at the given path from the data Go struct E.g data = { Friends: []Friend{ { Name: "John" } }, path = "Friends.0.Name" will return "John"
func IsNil ¶ added in v2.15.0
IsNil test if a given value is nil. It is saf to call the mthod with non nillable value like scalar types
func ListFields ¶
ListFields will recursively list all fields path that can be used with GetType or GetValue
func ListFieldsWithFilter ¶
func ListFieldsWithFilter(t reflect.Type, filter ListFieldFilter) []string
ListFieldsWithFilter is the same as ListFields but accept a filter method that will be call for each fields
Types ¶
type NilValueError ¶ added in v2.15.0
type NilValueError struct {
Path string
}
func NewNilValueError ¶ added in v2.15.0
func NewNilValueError(path string) *NilValueError
func (*NilValueError) Error ¶ added in v2.15.0
func (e *NilValueError) Error() string
Click to show internal directories.
Click to hide internal directories.