yqlib

package
v3.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorizeAndPrint

func ColorizeAndPrint(bytes []byte, writer io.Writer) error

func DebugNode

func DebugNode(value *yaml.Node)

func KindString

func KindString(kind yaml.Kind) string

Types

type DataNavigator

type DataNavigator interface {
	Traverse(value *yaml.Node, path []interface{}) error
}

func NewDataNavigator

func NewDataNavigator(NavigationStrategy NavigationStrategy) DataNavigator

type Encoder

type Encoder interface {
	Encode(node *yaml.Node) error
}

func NewJsonEncoder

func NewJsonEncoder(destination io.Writer, prettyPrint bool, indent int) Encoder

func NewYamlEncoder

func NewYamlEncoder(destination io.Writer, indent int, colorise bool) Encoder
type NavigationStrategy interface {
	FollowAlias(nodeContext NodeContext) bool
	AutoCreateMap(nodeContext NodeContext) bool
	Visit(nodeContext NodeContext) error
	// node key is the string value of the last element in the path stack
	// we use it to match against the pathExpression in head.
	ShouldTraverse(nodeContext NodeContext, nodeKey string) bool
	ShouldDeeplyTraverse(nodeContext NodeContext) bool
	GetVisitedNodes() []*NodeContext
	DebugVisitedNodes()
	GetPathParser() PathParser
}

func DeleteNavigationStrategy

func DeleteNavigationStrategy(pathElementToDelete interface{}) NavigationStrategy

func FilterMatchingNodesNavigationStrategy

func FilterMatchingNodesNavigationStrategy(value string) NavigationStrategy

func ReadNavigationStrategy

func ReadNavigationStrategy(deeplyTraverseArrays bool) NavigationStrategy

func UpdateNavigationStrategy

func UpdateNavigationStrategy(updateCommand UpdateCommand, autoCreate bool) NavigationStrategy
type NavigationStrategyImpl struct {
	// contains filtered or unexported fields
}
func (ns *NavigationStrategyImpl) AutoCreateMap(nodeContext NodeContext) bool
func (ns *NavigationStrategyImpl) DebugVisitedNodes()
func (ns *NavigationStrategyImpl) FollowAlias(nodeContext NodeContext) bool
func (ns *NavigationStrategyImpl) GetPathParser() PathParser
func (ns *NavigationStrategyImpl) GetVisitedNodes() []*NodeContext
func (ns *NavigationStrategyImpl) ShouldDeeplyTraverse(nodeContext NodeContext) bool
func (ns *NavigationStrategyImpl) ShouldTraverse(nodeContext NodeContext, nodeKey string) bool
func (ns *NavigationStrategyImpl) Visit(nodeContext NodeContext) error

type NodeContext

type NodeContext struct {
	Node      *yaml.Node
	Head      interface{}
	Tail      []interface{}
	PathStack []interface{}
}

func NewNodeContext

func NewNodeContext(node *yaml.Node, head interface{}, tail []interface{}, pathStack []interface{}) NodeContext

type PathParser

type PathParser interface {
	ParsePath(path string) []interface{}
	MatchesNextPathElement(nodeContext NodeContext, nodeKey string) bool
	IsPathExpression(pathElement string) bool
}

func NewPathParser

func NewPathParser() PathParser

type UpdateCommand

type UpdateCommand struct {
	Command   string
	Path      string
	Value     *yaml.Node
	Overwrite bool
}

type ValueParser

type ValueParser interface {
	Parse(argument string, customTag string) *yaml.Node
}

func NewValueParser

func NewValueParser() ValueParser

type YqLib

type YqLib interface {
	Get(rootNode *yaml.Node, path string, deeplyTraverseArrays bool) ([]*NodeContext, error)
	Update(rootNode *yaml.Node, updateCommand UpdateCommand, autoCreate bool) error
	New(path string) yaml.Node

	PathStackToString(pathStack []interface{}) string
	MergePathStackToString(pathStack []interface{}, appendArrays bool) string
}

func NewYqLib

func NewYqLib() YqLib

Jump to

Keyboard shortcuts

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