Documentation ¶
Index ¶
- func DeleteNode(node *yaml.Node, key *YamlIndex) error
- func GetKeyValue(node *yaml.Node, key string) (*yaml.Node, error)
- func GetNode(root *yaml.Node, key *YamlIndex) (*yaml.Node, error)
- func HasKeyValue(node *yaml.Node, key string, values ...string) (bool, error)
- func HasNode(root *yaml.Node, key *YamlIndex) bool
- func Iterate(root *yaml.Node, callable func(parent, value *yaml.Node))
- func SetKeyValue(node *yaml.Node, key string, value string) error
- type NodePair
- type YamlIndex
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteNode ¶
DeleteNode will delete the key and content nodes for the given key
func GetKeyValue ¶ added in v0.18.0
GetKeyValue gets the value of the key from the node (assumed to be a mapping node)
func HasKeyValue ¶
HasKeyValue checks if the node (assumed to be a mapping node) has a key with the given value(s). If many values, any is ok. If it does not, (false, nil) is returned. If there is an error, like a key not existing, an error is returned.
func Iterate ¶
func Iterate(root *yaml.Node, callable func(parent, value *yaml.Node))
Iterate runs through all of the content nodes in the indicated root node
func SetKeyValue ¶
SetKeyValue set's the content node's value to value for the indicated key
Types ¶
type NodePair ¶
type NodePair struct { Key *yaml.Node Value *yaml.Node }
NodePair is a convenience wrapper for two nodes, usually a key/value pair.
type YamlIndex ¶
type YamlIndex struct {
// contains filtered or unexported fields
}
YamlIndex identifies a path in a Yaml Node Tree
func CreateYamlIndex ¶
CreateYamlIndex creates a YamlIndex that specifies the Key via string parts. e.g. a key maybe be: parent.child.favoriteNumber and the returned YamlIndex would reflect this. Note: this does not yet support indexing array values.