Documentation ¶
Overview ¶
This library provides an easy way to access nested struct visible fields relying either on the names of such fields as assigned in the json tags or by their name in the code. It relies on the well known chaining of the keys with dots so, for example, to request the value at `a.b.c` corresponds to expecting the following nested structs:
type Container struct { A TypeA `json:"a"` } type TypeA struct { B TypeB `json:"b"` } type TypeB struct { C string `json:"c"` }
The above might also have been references.
There is only one function to do so: Get. It accepts interface{} and returns a tuple (interface{}, error), so it is the caller's responsibility to check for errors and to cast the result in the appropriate type. If, at whichever level, one of the keys in the chain is missing, the Get returns ErrKeyNotFound.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrKeyNotFound = internal.ErrKeyNotFound
ErrKeyNotFound indicates that the key
Functions ¶
Types ¶
This section is empty.