diff

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
)

Functions

func RenderPrimitiveValue

func RenderPrimitiveValue(v reflect.Value) string

Types

type Node

type Node struct {
	Path       []PathStep
	PathString string
	TypeX      reflect.Type
	TypeY      reflect.Type
	ValueX     reflect.Value
	ValueY     reflect.Value
}

func (Node) StringX

func (n Node) StringX() string

func (Node) StringY

func (n Node) StringY() string

type Nodes

type Nodes []Node

func (Nodes) Find

func (ns Nodes) Find(query string) (Nodes, error)

func (Nodes) FindByPrefix

func (ns Nodes) FindByPrefix(prefix string) Nodes

func (Nodes) FindOne

func (ns Nodes) FindOne(query string) (*Node, error)

type Option

type Option func(*differ)

func WithIgnoreAddingMapKeys

func WithIgnoreAddingMapKeys() Option

WithIgnoreAddingMapKeys configures differ to ignore all map keys that were added to the second object and missing in the first one.

type PathStep

type PathStep struct {
	Type       PathStepType
	MapIndex   string
	SliceIndex int
}

func (PathStep) String

func (s PathStep) String() string

type PathStepType

type PathStepType string
const (
	MapIndexPathStep   PathStepType = "MapIndex"
	SliceIndexPathStep PathStepType = "SliceIndex"
)

type RenderOption

type RenderOption func(*Renderer)

func WithLeftPadding

func WithLeftPadding(p int) RenderOption

func WithRedactPath

func WithRedactPath(prefix, replacementX, replacementY string) RenderOption

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

func NewRenderer

func NewRenderer(opts ...RenderOption) *Renderer

func (*Renderer) Render

func (r *Renderer) Render(ns Nodes) string

type Result

type Result struct {
	// contains filtered or unexported fields
}

func DiffUnstructureds

func DiffUnstructureds(x, y unstructured.Unstructured, opts ...Option) (*Result, error)

DiffUnstructureds calculates the diff between two unstructured objects.

func (*Result) HasDiff

func (r *Result) HasDiff() bool

func (*Result) Nodes

func (r *Result) Nodes() Nodes

func (*Result) NumNodes

func (r *Result) NumNodes() int

Jump to

Keyboard shortcuts

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