diff

package
v1.0.69 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ModChange leaf's value is being updated
	ModChange = ModificationType("Change")
	// ModDelete node is being removed
	ModDelete = ModificationType("Delete")
	// ModAdd leaf value is being added
	ModAdd = ModificationType("Add")
)

Variables

This section is empty.

Functions

func Apply

func Apply(node dom.ContainerBuilder, mods []Modification)

func DefaultListDiffFn added in v1.0.69

func DefaultListDiffFn(ctx DifferContext, left, right dom.List, pb path.Builder)

DefaultListDiffFn drops right list and flatten left one into series of additions.

func Diff

func Diff(left, right dom.Container, opts ...Opt) *[]Modification

Diff computes difference between 2 Containers

func K8sListDiffFn added in v1.0.69

func K8sListDiffFn(ctx DifferContext, left, right dom.List, pb path.Builder)

func OverlayDocs added in v1.0.59

func OverlayDocs(left, right dom.OverlayDocument, opts ...Opt) map[string]*[]Modification

OverlayDocs computes semantic difference between 2 Overlay documents

Types

type DifferContext added in v1.0.67

type DifferContext interface {
	// Append appends modification to the result slice
	Append(mt ModificationType, p path.Path, oldVal, newVal interface{})
	// Flatten flattens out Node into sequence of Modifications.
	Flatten(node dom.Node, pb path.Builder)
	// ListDiff compares 2 lists and generates list of modification from their difference using provided function
	ListDiff(left, right dom.List, pb path.Builder, fn ListDiffFn)

	ContainerDiff(left, right dom.Container, pb path.Builder)
}

type ListDiffFn added in v1.0.67

type ListDiffFn func(ctx DifferContext, left, right dom.List, pb path.Builder)

type Modification

type Modification struct {
	Type     ModificationType `yaml:"type"`
	Path     string           `yaml:"path"`
	Value    interface{}      `yaml:"value,omitempty"`
	OldValue interface{}      `yaml:"oldValue,omitempty"`
}

func (*Modification) String

func (m *Modification) String() string

type ModificationType

type ModificationType string

type Opt added in v1.0.67

type Opt func(*differ)

func WithListDiffFn added in v1.0.67

func WithListDiffFn(fn ListDiffFn) Opt

Jump to

Keyboard shortcuts

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