Documentation ¶
Overview ¶
Package yamlutils - Utilities to read yml files like if using xpath
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrExtraElementsInPath = fmt.Errorf("extra elements in path")
ErrExtraElementsInPath - Indicates when there is a final match and there are remaining path elements.
var ErrInvalidChildTypeKeyValue = fmt.Errorf("invalid child type, must be 'key: value'")
ErrInvalidChildTypeKeyValue - The child type is invalid.
var ErrInvalidIndex = fmt.Errorf("invalid index")
ErrInvalidIndex - The given index is invalid.
var ErrInvalidParentType = fmt.Errorf("invalid parent type, must be list or key/value")
ErrInvalidParentType - The parent type is invalid.
var ErrMapKeyNotFound = fmt.Errorf("map key not found")
ErrMapKeyNotFound - Key not in config.
var ErrNotAnIndex = fmt.Errorf("not an index")
ErrNotAnIndex - The given path is not a numerical index and the element is of type slice/array.
Logger - Custom lib logger
Functions ¶
func AddChildToTree ¶
func NavigateTree ¶
NavigateTree allows you to define a path string to traverse a tree composed of maps and arrays. To navigate through slices/arrays use a numerical index, for example: [path to array 1] When include is true, the returned map will have the key as part of it.
Types ¶
type YML ¶
type YML struct {
Tree interface{}
}
YML object
func NewFromFile ¶
NewFromFile returns a pointer to a YML object from a file.
func NewFromReader ¶
NewFromReader returns a pointer to a YML object from an io.Reader.
func NewFromString ¶
NewFromString - returns a pointer to a YML object from a string.