Documentation
¶
Index ¶
- func LookupKey(node *yaml.Node, key string) (*yaml.Node, *yaml.Node)
- func MoveYamlKey(rootNode *yaml.Node, oldPath []string, newPath []string) (error, bool)
- func RemoveKey(node *yaml.Node, key string) (*yaml.Node, *yaml.Node)
- func RenameYamlKey(rootNode *yaml.Node, path []string, newKey string) (error, bool)
- func TransformNode(rootNode *yaml.Node, path []string, transform func(node *yaml.Node) error) error
- func Walk(rootNode *yaml.Node, callback func(node *yaml.Node, path string)) error
- func YamlMarshal(node *yaml.Node) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MoveYamlKey ¶ added in v0.63.0
Takes the root node of a yaml document, the path to an existing key, and the path at which it should live instead. If the key exists, it (and its value) is moved to the new path, creating intermediate mapping nodes as needed, and any mapping nodes left empty behind it are removed. Does nothing if the key at oldPath doesn't exist. Returns an error if a key already exists at newPath, or if a node along either path exists but isn't a mapping.
func RenameYamlKey ¶
Takes the root node of a yaml document, a path to a key, and a new name for the key. Will rename the key to the new name if it exists, and do nothing otherwise.
func TransformNode ¶ added in v0.47.0
Walks a yaml document from the root node to the specified path, and then applies the transformation to that node. If the requested path is not defined in the document, no changes are made to the document.
Types ¶
This section is empty.