yamled

package
v1.9.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package yamled allows editing arbitrary YAML documents as parsed by gopkg.in/yaml.v2.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

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

func Load

func Load(r io.Reader) (*Document, error)

func NewFromMapSlice

func NewFromMapSlice(m yaml.MapSlice) (*Document, error)

func (*Document) Append

func (d *Document) Append(path Path, newValue any) bool

func (*Document) Fill

func (d *Document) Fill(path Path, newValue any) bool

Fill will set the value at the path to the newValue, but keeps any existing sub values intact.

func (*Document) Get

func (d *Document) Get(path Path) (any, bool)

func (*Document) GetArray

func (d *Document) GetArray(path Path) ([]any, bool)

func (*Document) GetBool

func (d *Document) GetBool(path Path) (bool, bool)

func (*Document) GetInt

func (d *Document) GetInt(path Path) (int, bool)

func (*Document) GetString

func (d *Document) GetString(path Path) (string, bool)

func (*Document) Has

func (d *Document) Has(path Path) bool

func (*Document) MarshalYAML

func (d *Document) MarshalYAML() (any, error)

func (*Document) Remove

func (d *Document) Remove(path Path) bool

func (*Document) Root

func (d *Document) Root() yaml.MapSlice

func (*Document) Set

func (d *Document) Set(path Path, newValue any) bool

func (*Document) Walk added in v1.9.0

func (d *Document) Walk(path Path, walkFn func(Path, any))

type Path

type Path []Step

func (Path) Parent

func (p Path) Parent() Path

func (Path) String

func (p Path) String() string

func (Path) Tail

func (p Path) Tail() Step

type Step

type Step any

Jump to

Keyboard shortcuts

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