y7s

package
v0.0.0-...-813bd67 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMap

func AddMap(n *yaml.Node, pp ...interface{}) (*yaml.Node, error)

AddMap adds a new item to the provided mapping node

pp is a set of k, v items; where k's lie at i, and v's lie at i+1. non-string values (required by YAML nodes) are processed further. eg.: ["k1", "v1", "k2", "v2"]

func AddSeq

func AddSeq(n *yaml.Node, vv ...interface{}) (*yaml.Node, error)

AddSeq adds new items to the sequence node

func CleanMap

func CleanMap(n *yaml.Node) *yaml.Node

CleanMap helper removes any empty k:v nodes from the mapping node

The value is empty when the tag is !!null OR when the value and the content are empty

func DecodeScalar

func DecodeScalar(n *yaml.Node, name string, val interface{}) error

Checks validity of ref node and sets the value to given arg ptr

func Each

func Each(n *yaml.Node, fn func(*yaml.Node, *yaml.Node) error) error

each helps iterate over mapping and sequence nodes fairly trivially

func EachMap

func EachMap(n *yaml.Node, fn func(*yaml.Node, *yaml.Node) error) error

eachKV iterates over map node

func EachSeq

func EachSeq(n *yaml.Node, fn func(*yaml.Node) error) error

eachKV iterates over sequence node

func FindKeyNode

func FindKeyNode(n *yaml.Node, key string) *yaml.Node

findKeyNode returns key node from mapping key value checked in lower case

func IsKind

func IsKind(n *yaml.Node, tt ...yaml.Kind) bool

func IsMapping

func IsMapping(n *yaml.Node) bool

func IsSeq

func IsSeq(n *yaml.Node) bool

func MakeMap

func MakeMap(pp ...interface{}) (*yaml.Node, error)

MakeMap creates a new mapping node based on the provided k, v items

pp is a set of k, v items; where k's lie at i, and v's lie at i+1. non-string values (required by YAML nodes) are processed further. eg.: ["k1", "v1", "k2", "v2"]

func MakeSeq

func MakeSeq(vv ...interface{}) (*yaml.Node, error)

MakeSeq creates a new sequence node based on the provided items

func NodeErr

func NodeErr(n *yaml.Node, format string, aa ...interface{}) error

func SeqToMap

func SeqToMap(ss *yaml.Node, k string) (*yaml.Node, error)

SeqToMap converts the given sequence node into a mapping node

The provided value defined by field k is used as the map key. The used value is removed from the map value. If the field is not found, an error is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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