node

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 4 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clone

func Clone(node *yaml.Node) *yaml.Node

Clone returns a copy of the provided node

func RemoveFromMap added in v1.4.0

func RemoveFromMap(node *yaml.Node, name string) error

Remove a map key-value pair from node.Content

func SetMapValue added in v1.4.0

func SetMapValue(parent *yaml.Node, name string, val *yaml.Node)

Add or replace a map value

func ToJson added in v1.4.0

func ToJson(node *yaml.Node) string

Convert a node to JSON

Types

type NodePair added in v1.4.0

type NodePair struct {
	Key   *yaml.Node
	Value *yaml.Node

	// Parent is used by modules to reference the parent template resource
	Parent *NodePair
}

NodePair represents a !!map key-value pair

func GetParent added in v1.4.0

func GetParent(node *yaml.Node, rootNode *yaml.Node, priorNode *yaml.Node) NodePair

Returns the parent node of node, paired with its name if it's a map pair. If it is not a map pair, only NodePair.Value is not nil. (YAML maps are arrays with even indexes being names and odd indexes being values)

node

Content
  0: Name
  1: Map
    Content
      0: a
      1: b

In the above, if I want b's parent node pair, I get [Name, Map] This allows us to ask "what is the parent's name", which is useful for knowing the logical name of the resource a node belongs to

Jump to

Keyboard shortcuts

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