yaml

package
v1.16.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LiteralValue added in v1.5.0

type LiteralValue struct {
	// Value is the actual value to be written
	//
	// for example:
	//  yw := NewWriter(nil)
	//  yw.WriteTagValue("foo", LiteralValue{Value: "[]"})
	// would result in yaml:
	//  foo: []
	Value string
	// SafeEncodeString if set to true, indicates that the Value is an actual string value and should be safely yanl encoded accordingly
	SafeEncodeString bool
}

LiteralValue enables unadulterated values to be written to yaml

type RefChecker added in v1.8.3

type RefChecker interface {
	RefCheck(area, ref string) error
}

RefChecker is an interface optionally used by Writer.RefChecker so that refs can be checked for existence

type Writer

type Writer interface {
	Flush() error
	Bytes() ([]byte, error)
	WriteTagValue(name string, value any) Writer
	WriteTagStart(name string) Writer
	WriteTagEnd() Writer
	WritePathStart(context string, path string) Writer
	WriteItem(value any) Writer
	WriteItemValue(name string, value any) Writer
	WriteItemStart(name string, value any) Writer
	// WriteLines writes the provided lines (current indent is added to each line)
	WriteLines(lines ...string) Writer
	// Write writes the provided data (no indent is added - and data must include indents!)
	Write(data []byte) Writer
	WriteComments(lines ...string) Writer
	CurrentIndent() string
	SetError(err error)
	Errored() error
	RefChecker(rc RefChecker) RefChecker
}

func NewWriter

func NewWriter(w *bufio.Writer) Writer

NewWriter creates a new yaml writer using the provided *bufio.Writer

If the *bufio.Writer is nil, an internal buffered writer is used

Jump to

Keyboard shortcuts

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