yaml

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(w io.Writer, data map[string]interface{}, pe ...PreEncoder) error

Encode encodes the given data to YAML format and writes it to the provided io.Write, without going through a byte representation (unlike sigs.k8s.io/yaml#Unmarshal).

It optionally takes one or more PreEncoder functions that allow for pre-processing of the data before encoding, such as sorting the data.

It returns an error if the data cannot be encoded.

func SortMapSlice

func SortMapSlice(ms goyaml.MapSlice)

SortMapSlice recursively sorts the given goyaml.MapSlice by key. It can be used in combination with Encode to sort YAML by key before encoding it.

Types

type PreEncoder

type PreEncoder func(goyaml.MapSlice)

PreEncoder allows for pre-processing of the YAML data before encoding.

Jump to

Keyboard shortcuts

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