Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Diff ¶
type Diff struct {
// Path to the field that has difference separated by period. Array index and key are designated by square brackets.
// For example, Annotations[12345].Data.Fields[0].ID
Path string
Left reflect.Value
Right reflect.Value
}
func (*Diff) IsAddOperation ¶
IsAddOperation returns true when
- Left does not have value and Right has
- the kind of Left and Right is either reflect.Slice or reflect.Map and the length of Left is less than length of Right
In all other cases it returns false. NOTE: this is applicable to diff of Maps and Slices only
func (*Diff) IsDeleteOperation ¶
IsDeleteOperation returns true when
- Right does not have value and Left has
- the kind of Left and Right is either reflect.Slice or reflect.Map and the length of Right is less than length of Left
In all other cases it returns false. NOTE: this is applicable to diff of Maps and Slices only
type DiffReport ¶
type DiffReport []Diff
func (DiffReport) GetDiffsForField ¶
func (r DiffReport) GetDiffsForField(path string) DiffReport
GetDiffsForField returns subset of the diffs which path starts with the provided path
func (DiffReport) Paths ¶
func (r DiffReport) Paths() []string
Paths returns the slice of paths of the current DiffReport
func (DiffReport) String ¶
func (r DiffReport) String() string
type DiffReporter ¶
type DiffReporter struct {
Diffs DiffReport
// contains filtered or unexported fields
}
DiffReporter is a simple custom reporter that only records differences detected during comparison. Implements an interface required by cmp.Reporter option
func (*DiffReporter) PopStep ¶
func (r *DiffReporter) PopStep()
func (*DiffReporter) PushStep ¶
func (r *DiffReporter) PushStep(ps cmp.PathStep)
func (*DiffReporter) Report ¶
func (r *DiffReporter) Report(rs cmp.Result)
Click to show internal directories.
Click to hide internal directories.