yaml_utils

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenameYamlKey

func RenameYamlKey(yamlBytes []byte, path []string, newKey string) ([]byte, error)

takes a yaml document in bytes, 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 UpdateYamlValue

func UpdateYamlValue(yamlBytes []byte, path []string, value string) ([]byte, error)

takes a yaml document in bytes, a path to a key, and a value to set. The value must be a scalar.

func Walk added in v0.42.0

func Walk(yamlBytes []byte, callback func(node *yaml.Node, path string) bool) ([]byte, error)

Traverses a yaml document, calling the callback function for each node. The callback is allowed to modify the node in place, in which case it should return true. The function returns the original yaml document if none of the callbacks returned true, and the modified document otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

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