walk

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2020 License: Apache-2.0 Imports: 10 Imported by: 6

Documentation

Index

Constants

View Source
const (
	DestIndex = iota
	OriginIndex
	UpdatedIndex
)

Variables

View Source
var ClearNode *yaml.RNode

ClearNode is returned if GrepFilter should do nothing after calling Set

Functions

This section is empty.

Types

type FieldSources

type FieldSources []*yaml.MapNode

func (FieldSources) Dest

func (s FieldSources) Dest() *yaml.MapNode

Dest returns the destination node

func (FieldSources) Origin

func (s FieldSources) Origin() *yaml.MapNode

Origin returns the origin node

func (FieldSources) Updated

func (s FieldSources) Updated() *yaml.MapNode

Updated returns the updated node

type ListKind

type ListKind int32
const (
	AssociativeList ListKind = 1 + iota
	NonAssociateList
)

type Sources

type Sources []*yaml.RNode

func (Sources) Dest

func (s Sources) Dest() *yaml.RNode

Dest returns the destination node

func (Sources) Origin

func (s Sources) Origin() *yaml.RNode

Origin returns the origin node

func (Sources) String

func (s Sources) String() string

func (Sources) Updated

func (s Sources) Updated() *yaml.RNode

Updated returns the updated node

type Visitor

type Visitor interface {
	VisitMap(Sources, *openapi.ResourceSchema) (*yaml.RNode, error)

	VisitScalar(Sources, *openapi.ResourceSchema) (*yaml.RNode, error)

	VisitList(Sources, *openapi.ResourceSchema, ListKind) (*yaml.RNode, error)
}

Visitor is invoked by walk with source and destination node pairs

type Walker

type Walker struct {
	// Visitor is invoked by GrepFilter
	Visitor

	Schema *openapi.ResourceSchema

	// Source is the RNode to walk.  All Source fields and associative list elements
	// will be visited.
	Sources Sources

	// Path is the field path to the current Source Node.
	Path []string

	// InferAssociativeLists if set to true will infer merge strategies for
	// fields which it doesn't have the schema based on the fields in the
	// list elements.
	InferAssociativeLists bool

	// VisitKeysAsScalars if true will call VisitScalar on map entry keys,
	// providing nil as the OpenAPI schema.
	VisitKeysAsScalars bool
}

Walker walks the Source RNode and modifies the RNode provided to GrepFilter.

func (Walker) GetSchema added in v0.1.1

func (l Walker) GetSchema() *openapi.ResourceSchema

func (Walker) Kind

func (l Walker) Kind() yaml.Kind

func (Walker) Walk

func (l Walker) Walk() (*yaml.RNode, error)

GrepFilter implements yaml.GrepFilter

Jump to

Keyboard shortcuts

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