Documentation ¶
Index ¶
- func EnsureFlatList(n *yaml.Node) *yaml.Node
- func EnsureList(n *yaml.Node) *yaml.Node
- func EnsureMapMap(n *yaml.Node) *yaml.Node
- func HandleCustomTag(n *yaml.Node, tag string, fn TagProcessor) error
- func IsScalarMap(n *yaml.Node) bool
- func ListToMapVal(n *yaml.Node, key string) *yaml.Node
- func LoadFileFragment(path string) (*yaml.Node, error)
- func LoadIncludeDirNamedTag(n *yaml.Node) error
- func LoadIncludeTag(n *yaml.Node) error
- func MapKeyIntoValueMap(n *yaml.Node, keyKey string) *yaml.Node
- func MapKeys(n *yaml.Node) []string
- func MapSplitKeyVal(n *yaml.Node, keyKey, valKey string) *yaml.Node
- func MapToSliceMap(n *yaml.Node) *yaml.Node
- func ParseBoolNode(n *yaml.Node) (value bool, ok bool)
- func ScalarToList(n *yaml.Node) *yaml.Node
- func ScalarToMap(n *yaml.Node) *yaml.Node
- func ScalarToMapVal(n *yaml.Node, key string) *yaml.Node
- type Fragment
- type TagProcessor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureFlatList ¶
func EnsureFlatList(n *yaml.Node) *yaml.Node
EnsureFlatList will flatten nested lists of yaml nodes expects to be passed a yaml.SequenceNode
func EnsureList ¶
func EnsureList(n *yaml.Node) *yaml.Node
EnsureList will ensure that the base node is a SequenceNode
key: val ========= - key: val
func EnsureMapMap ¶
func EnsureMapMap(n *yaml.Node) *yaml.Node
EnsureMapMap will ensure that the node is a map and that the value is not null
key: null > key: {} string > string: {}
func HandleCustomTag ¶
func HandleCustomTag(n *yaml.Node, tag string, fn TagProcessor) error
HandleCustomTag is used to define a custom YAML tags, it will recursively search YAML nodes for the tag and call the tag processor function.
func IsScalarMap ¶
func IsScalarMap(n *yaml.Node) bool
IsScalarMap tests if n is a map that contains only scalar keys and values
func ListToMapVal ¶
func ListToMapVal(n *yaml.Node, key string) *yaml.Node
ListToMapVal converts a sequence node to a mapping of {key: node} does nothing if n is not a sequence node.
[i1, i2] key: [i1, i2]
func LoadFileFragment ¶
LoadFileFragment reads in and parses a given file returning a YAML node.
func LoadIncludeDirNamedTag ¶
func LoadIncludeDirNamedTag(n *yaml.Node) error
LoadIncludeDirNamedTag recursively searches for the !include_dir_named tag from the given node and will replace the tag node with map of filename to content for each file in the directory.
func LoadIncludeTag ¶
func LoadIncludeTag(n *yaml.Node) error
LoadIncludeTag recursively searches for the !include tag from the given node and will replace the tag node with content of the included file.
func MapKeyIntoValueMap ¶
func MapKeyIntoValueMap(n *yaml.Node, keyKey string) *yaml.Node
MapKeyIntoValueMap if the value is a map moves the key into the map with the specified name
key1: key2: val2 ============ key2: val2 keyKey: key1
func MapKeys ¶
func MapKeys(n *yaml.Node) []string
MapKeys will return a list of the keys in a map, or an empty list if the node is not a map
func MapSplitKeyVal ¶
func MapSplitKeyVal(n *yaml.Node, keyKey, valKey string) *yaml.Node
MapSplitKeyVal splits a maps key and val into their own maps using the specified keys
key: val =========== keyKey: key valKey: val
func MapToSliceMap ¶
func MapToSliceMap(n *yaml.Node) *yaml.Node
MapToSliceMap converts a map to a slice of maps with one key each
key1: key2: val1 key3: val2 ============== - key1: key2: val1 - key3: val2
func ParseBoolNode ¶
ParseBoolNode will parse a boolean node and return its value if the node is not a boolean node `ok` will be false. This is useful if you want to apply a different transform based on a boolean flag in the YAML.
func ScalarToList ¶
func ScalarToList(n *yaml.Node) *yaml.Node
ScalarToList wraps a scalar node in a sequence node
string ======== - string
func ScalarToMap ¶
func ScalarToMap(n *yaml.Node) *yaml.Node
ScalarToMap will convert a scalar node to a mapping of {scalar: nil}
string ======== string: null
func ScalarToMapVal ¶
func ScalarToMapVal(n *yaml.Node, key string) *yaml.Node
ScalarToMapVal converts a scalar node to a mapping of {key: node} does nothing if n is not a scalar node.
string > key: string
Types ¶
type Fragment ¶
type Fragment struct {
Content *yaml.Node
}
Fragment is used to parse YAML into a node instead of an interface.
func (*Fragment) UnmarshalYAML ¶
type TagProcessor ¶
type TagProcessor = func(n *yaml.Node) error