yaml

package
v0.5.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read(paths []string) ([]byte, error)

Read reads all files represented by the given paths having a .yaml or .yml extension, joins them with "\n---\n", and returns the result. For any path that is a directory, it recursively reads all files in the directory. This function performs no validation on the contents of the files.

func SetStringsInBytes

func SetStringsInBytes(
	inBytes []byte,
	changes map[string]string,
) ([]byte, error)

SetStringsInBytes returns a copy of the provided bytes with the changes specified by the changes map applied. The changes map maps keys to new values. Keys are of the form <key 0>.<key 1>...<key n>. Integers may be used as keys in cases where a specific node needs to be selected from a sequence. Individual changes are ignored without error if their key is not found or if their key is found not to address a scalar node. Importantly, all comments and style choices in the input bytes are preserved in the output.

func SetStringsInFile

func SetStringsInFile(file string, changes map[string]string) error

SetStringsInFile overwrites the specified file with the changes specified by the changes map applied. The changes map maps keys to new values. Keys are of the form <key 0>.<key 1>...<key n>. Integers may be used as keys in cases where a specific node needs to be selected from a sequence. Individual changes are ignored without error if their key is not found or if their key is found not to address a scalar node. Importantly, all comments and style choices in the input bytes are preserved in the output.

Types

This section is empty.

Jump to

Keyboard shortcuts

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