Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func At ¶
At access a field of v by a path. v must be struct or pointer of struct. A path is represented by Go's expression which can be parsed by go/parser.ParseExpr. You can use selectors and indexes in a path. Slice and arrays index allow only expressions of int. Maps key allow only expressions of string, int and float64.
Example ¶
type Bar struct {
N []int
}
type Foo struct {
Bar *Bar
}
f := &Foo{
Bar: &Bar{
N: []int{100},
},
}
v, err := At(f, `Bar.N[0]`)
if err != nil {
fmt.Println(err)
} else {
fmt.Println(v)
}
Output: 100
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.