Documentation ¶
Index ¶
- func KeyValue(node *yaml.Node) iter.Seq2[*yaml.Node, *yaml.Node]
- func Keys(node *yaml.Node) iter.Seq[*yaml.Node]
- func LookupKey(node *yaml.Node, key string) (*yaml.Node, bool)
- func LookupValueFunc(node *yaml.Node, checkKey func(n *yaml.Node) bool) (*yaml.Node, bool)
- func ValuesStrings(nodes []*yaml.Node) iter.Seq[string]
- func Walk(node *yaml.Node, fn func(node *yaml.Node) error, kinds yaml.Kind) error
- type WithDataType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KeyValue ¶ added in v0.2.0
KeyValue iterates over a yaml.MappingNode kinda like a map[*yaml.Node]*yaml.Node It iterates multiple content elements in yaml.DocumentNode and will follow yaml.AliasNode.
func Keys ¶
Keys returns the keys of a yaml.MappingNode. It uses KeyValue and will iterate yaml.DocumentNode and yaml.AliasNode.
func LookupKey ¶
LookupKey does a simple lookup of a string key in a yaml.MappingNode it does not support recursive lookup, or any other fancy features. Consider using Walk or github.com/mikefarah/yq/v3/pkg/yqlib for more sophisticated queries.
func LookupValueFunc ¶ added in v0.2.0
LookupValueFunc does a simple lookup of a node in a yaml.MappingNode It does not support recursive lookup, or any other fancy features. It uses KeyValue and will iterate yaml.DocumentNode and yaml.AliasNode.
func ValuesStrings ¶
ValuesStrings returns the Value fields from a yaml.Node of a list of nodes.
Types ¶
type WithDataType ¶
type WithDataType[T any] struct { Data T Node *yaml.Node }
WithDataType is a wrapper for a yaml.Node that also stores the decoded value. It is useful when you want to reflect back on the original yaml.Node after parsing. This may be helpful for providing richer error messages for configuration problems.
func (WithDataType[T]) MarshalYAML ¶
func (wt WithDataType[T]) MarshalYAML() (any, error)
func (*WithDataType[T]) UnmarshalYAML ¶
func (wt *WithDataType[T]) UnmarshalYAML(value *yaml.Node) error