yaml_utils

package
v0.51.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookupKey added in v0.51.0

func LookupKey(node *yaml.Node, key string) (*yaml.Node, *yaml.Node)

func RemoveKey added in v0.51.0

func RemoveKey(node *yaml.Node, key string) (*yaml.Node, *yaml.Node)

Returns the key and value if they were present

func RenameYamlKey

func RenameYamlKey(rootNode *yaml.Node, path []string, newKey string) (error, bool)

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

func TransformNode(rootNode *yaml.Node, path []string, transform func(node *yaml.Node) error) error

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.

func Walk added in v0.42.0

func Walk(rootNode *yaml.Node, callback func(node *yaml.Node, path string)) error

Traverses a yaml document, calling the callback function for each node. The callback is expected to modify the node in place

func YamlMarshal added in v0.48.0

func YamlMarshal(node *yaml.Node) ([]byte, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL