Documentation ¶
Index ¶
- type InvalidPathString
- type Path
- func (p Path) Concat(other Path) Path
- func (p Path) Extend(pc PathComponent) Path
- func (p Path) ExtendMap(key string) Path
- func (p Path) ExtendSlice(index int) Path
- func (p Path) GetFrom(m interface{}) (value interface{}, exists bool)
- func (p Path) Last() *PathComponent
- func (p Path) String() string
- type PathComponent
- type PathComponentType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InvalidPathString ¶
type InvalidPathString string
InvalidPathString is the error type returned from unparseable paths.
func (InvalidPathString) Error ¶
func (ps InvalidPathString) Error() string
type Path ¶
type Path []PathComponent
Path represents the Path within a nested set of maps.
func MustParsePath ¶
MustParsePath is a convenience method for parsing paths that have been previously validated
func (Path) Concat ¶
Concat combines two paths into a new Path without modifying any existing paths.
func (Path) Extend ¶
func (p Path) Extend(pc PathComponent) Path
Extend lengthens the given path with the given component.
func (Path) ExtendSlice ¶
ExtendSlice is used to add a new PathComponent of the pcSliceIdx type.
func (Path) Last ¶
func (p Path) Last() *PathComponent
Last returns a pointer to the Last PathComponent in this Path. If the Path empty, a nil pointer is returned.
type PathComponent ¶
type PathComponent struct { Type PathComponentType // One of pcMapKey or pcSliceIdx Key string // Populated for maps Index int // Populated for slices }
PathComponent structs represent one breadcrumb in a Path.
func (PathComponent) String ¶
func (pc PathComponent) String() string
type PathComponentType ¶
type PathComponentType int
PathComponentType indicates the type of PathComponent.
func (PathComponentType) String ¶
func (pct PathComponentType) String() string