yaml

package
v0.5.2 Latest Latest
Warning

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

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

Documentation

Overview

Package yaml provides tools for encoding and decoding YAML.

Index

Constants

This section is empty.

Variables

View Source
var (
	YAMLToJSON = yaml.YAMLToJSON
	JSONToYAML = yaml.JSONToYAML
	Unmarshal  = yaml.Unmarshal
	Marshal    = yaml.Marshal
)

The following functions are exported for testing purposes only.

Functions

func Convert added in v0.5.0

func Convert[O, I any](obj I) (o O, err error)

Convert converts an object to another object.

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder is a YAML decoder.

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

NewDecoder returns a new YAML decoder.

func (*Decoder) Decode

func (d *Decoder) Decode(obj any) error

Decode decodes YAML into an object.

func (*Decoder) DecodeToUnstructured added in v0.4.0

func (d *Decoder) DecodeToUnstructured(visitFunc func(obj *unstructured.Unstructured) error) error

DecodeToUnstructured decodes YAML into a list of unstructured objects.

func (*Decoder) DecodeUnstructured added in v0.5.0

func (d *Decoder) DecodeUnstructured() (*unstructured.Unstructured, error)

DecodeUnstructured decodes YAML into an unstructured object.

func (*Decoder) UndecodedUnstructured added in v0.5.0

func (d *Decoder) UndecodedUnstructured(obj *unstructured.Unstructured)

UndecodedUnstructured put a decoded unstructured object back to the decoder.

func (*Decoder) WithErrorHandler added in v0.5.0

func (d *Decoder) WithErrorHandler(handler func(error) error) *Decoder

WithErrorHandler sets the error handler for the decoder.

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder is a YAML encoder.

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

NewEncoder returns a new YAML printer.

func (*Encoder) Encode

func (p *Encoder) Encode(obj runtime.Object) error

Encode prints the object as YAML.

Jump to

Keyboard shortcuts

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