compare

package
v0.0.4-0...-cb4b663 Latest Latest
Warning

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

Go to latest
Published: May 7, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasNilDifference

func HasNilDifference(a, b interface{}) bool

HasNilDifference returns true if the supplied subjects' nilness is different

func MapStringStringPEqual

func MapStringStringPEqual(a, b map[string]*string) bool

MapStringStringPEqual returns true if the supplied maps are equal

func SliceStringPEqual

func SliceStringPEqual(a, b []*string) bool

SliceStringPEqual returns true if the supplied slices of string pointers have equal values regardless of order.

Types

type Delta

type Delta struct {
	// Differences is a slice of *ackcompare.Difference structs representing
	// differences in values of two resources under comparison
	Differences []*Difference
}

Delta represents differences between two AWSResources. The underlying types of the two supplied AWSResources should be the same. In other words, the Delta() method should be called with the same concrete implementing AWSResource type

func NewDelta

func NewDelta() *Delta

NewDelta returns a new Delta struct used to compare two resources.

func (*Delta) Add

func (d *Delta) Add(
	path string,
	a interface{},
	b interface{},
)

Add adds a new Difference to the Delta

func (*Delta) DifferentAt

func (d *Delta) DifferentAt(subject string) bool

DifferentAt returns whether there is a difference at the supplied JSONPath expression in the resources under comparison

type DiffItem

type DiffItem struct {
	Path string
}

func (*DiffItem) String

func (diff *DiffItem) String() string

type Difference

type Difference struct {
	// Path is the field path to the detected difference between resources
	// under comparison
	Path Path
	// A is the value of the first resource under comparison at the Path
	A interface{}
	// B is the value of the first resource under comparison at the Path
	B interface{}
}

Difference contains the difference in values for a specified field path into two compared resources.

type Path

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

Path provides a JSONPath-like struct and field-member "route" to a particular field within a compared struct

func NewPath

func NewPath(dotted string) Path

NewPath returns a new Path struct pointer from a dotted-notation string, e.g. "Author.Name"

func (Path) Contains

func (p Path) Contains(subject string) bool

Contains returns true if the supplied string appears within the Path

func (Path) Pop

func (p Path) Pop()

Pop removes the last part from the Path

func (Path) Push

func (p Path) Push(part string)

Push adds a new part to the Path.

type Reporter

type Reporter struct {
	Differences []DiffItem
	// contains filtered or unexported fields
}

func (*Reporter) PopStep

func (reporter *Reporter) PopStep()

func (*Reporter) PushStep

func (reporter *Reporter) PushStep(ps cmp.PathStep)

func (*Reporter) Report

func (reporter *Reporter) Report(result cmp.Result)

func (*Reporter) String

func (reporter *Reporter) String() string

Jump to

Keyboard shortcuts

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