Documentation ¶
Overview ¶
Package yamlmap is a wrapper of gopkg.in/yaml.v3 for interacting with yaml data as if it were a map.
Index ¶
- Variables
- func Marshal(m *Map) ([]byte, error)
- type Map
- func (m *Map) AddEntry(key string, value *Map)
- func (m *Map) Empty() bool
- func (m *Map) FindEntry(key string) (*Map, error)
- func (m *Map) IsModified() bool
- func (m *Map) Keys() []string
- func (m *Map) RemoveEntry(key string) error
- func (m *Map) SetEntry(key string, value *Map)
- func (m *Map) SetModified()
- func (m *Map) SetUnmodified()
- func (m *Map) String() string
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidFormat = errors.New("invalid format")
View Source
var ErrInvalidYaml = errors.New("invalid yaml")
View Source
var ErrNotFound = errors.New("not found")
Functions ¶
Types ¶
type Map ¶
type Map struct {
*yaml.Node
}
func StringValue ¶
func (*Map) IsModified ¶
Traverse map using BFS to searach for any nodes that have been modified.
func (*Map) RemoveEntry ¶
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.
Click to show internal directories.
Click to hide internal directories.