yamlmap

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package yamlmap is a wrapper of gopkg.in/yaml.v3 for interacting with yaml data as if it were a map.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = errors.New("not found")
	ErrInvalidYaml   = errors.New("invalid yaml")
	ErrInvalidFormat = errors.New("invalid format")
)

Functions

func Marshal

func Marshal(m *Map) ([]byte, error)

Types

type Map

type Map struct {
	*yaml.Node
}

func MapValue

func MapValue() *Map

func StringValue

func StringValue(value string) *Map

func Unmarshal

func Unmarshal(data []byte) (*Map, error)

func (*Map) AddEntry

func (m *Map) AddEntry(key string, value *Map)

func (*Map) Empty

func (m *Map) Empty() bool

func (*Map) FindEntry

func (m *Map) FindEntry(key string) (*Map, error)

func (*Map) IsModified

func (m *Map) IsModified() bool

Traverse map using BFS to searach for any nodes that have been modified.

func (*Map) Keys

func (m *Map) Keys() []string

func (*Map) RemoveEntry

func (m *Map) RemoveEntry(key string) error

func (*Map) SetEntry

func (m *Map) SetEntry(key string, value *Map)

func (*Map) SetModified

func (m *Map) SetModified()

Note: This is a hack to introduce the concept of modified/unmodified on top of gopkg.in/yaml.v3. This works by setting the Value property of a MappingNode to a specific value and then later checking if the node's Value property is that specific value. When a MappingNode gets output as a string the Value property is not used, thus changing it has no impact for our purposes.

func (*Map) SetUnmodified

func (m *Map) SetUnmodified()

Traverse map using BFS to set all nodes as unmodified.

func (*Map) String

func (m *Map) String() string

Jump to

Keyboard shortcuts

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