diff

package
v1.8.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff(left interface{}, right interface{}, opts ...Option)

Types

type Diffeable

type Diffeable interface {
	Diff(right interface{}, options ...Option)
}

type Event

type Event struct {
	Path Path
	Kind Kind
	Old  reflect.Value
	New  reflect.Value
}

func (*Event) AddedKind

func (p *Event) AddedKind() bool

func (*Event) ChangedKind

func (p *Event) ChangedKind() bool

func (*Event) Element

func (p *Event) Element() reflect.Value

Element picks the element based on the Event's Kind, if it's removed, the element is the "old" value, if it's added or changed, the element is the "new" value.

func (*Event) Match

func (p *Event) Match(pattern string) (match bool, matches []string)

Match currently simply ensure that `pattern` parameter is the start of the path string which represents the direct access from top-level to struct.

func (*Event) RawMatch

func (p *Event) RawMatch(rawPattern string) (match bool, matches []string)

func (*Event) RemovedKind

func (p *Event) RemovedKind() bool

func (*Event) String

func (p *Event) String() string

type Kind

type Kind uint8
const (
	KindAdded Kind = iota
	KindChanged
	KindRemoved
)

func (Kind) String

func (k Kind) String() string

type Option

type Option interface {
	// contains filtered or unexported methods
}

func CmpOption

func CmpOption(cmpOption cmp.Option) Option

func OnEvent

func OnEvent(callback func(Event)) Option

type Path

type Path cmp.Path

func (Path) SliceIndex

func (pa Path) SliceIndex() (int, bool)

func (Path) String

func (pa Path) String() string

Jump to

Keyboard shortcuts

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