Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comparator ¶
type Comparator struct { DiffLogger IgnoreTypes bool ProgressBar bool // contains filtered or unexported fields }
func NewComparator ¶
func NewComparator(lPath, rPath string, ignoreT bool) *Comparator
Comparator for JSON-files located at lPath and rPath.
If ignoreT set true JSONComparator will ignore type differences between similar values like "1.4" string and 1.4 float.
func NewComparatorWithKeys ¶
func NewComparatorWithKeys(lPath, rPath string, keys, ignoreKeys []string, ignoreT bool) *Comparator
Comparator for JSON-files located at lPath and rPath.
Uses keys and ignoreKeys to properly compare objects nested in an array. For example, you have: {"cats": [{"id": 4, "name": "Nyan"}, {"id": 2, "name": "Marx"}]}. If you want to set cat's "id" as a key, add "DATA.cats.<array>.id" to keys. DATA points out to the root of your JSON and <array> indicates object with key is nested in an array. ignoreKeys are used to ignore mismatches for particular keys. If ignoreT set true JSONComparator will ignore type differences between similar values like "1.4" string and 1.4 float.
func (*Comparator) CompWithLeft ¶
func (c *Comparator) CompWithLeft()
Looks for how the left JSON-file differs from the left one.
func (*Comparator) CompWithRight ¶
func (c *Comparator) CompWithRight()
Looks for how the right JSON-file differs from the right one.
func (*Comparator) CompareFull ¶
func (c *Comparator) CompareFull()
Looks for differences between files from both perspectives.
func (*Comparator) SaveDiffLogs ¶
func (c *Comparator) SaveDiffLogs()
Saves logs for last performed comparison as a text file.
func (*Comparator) TargetKeyValMap ¶
func (c *Comparator) TargetKeyValMap(src interface{}, keys []string) map[string]interface{}
type DiffLogger ¶
type DiffLogger struct { Log []string // contains filtered or unexported fields }
func (*DiffLogger) Summary ¶
func (l *DiffLogger) Summary() string
Returns formatted summary for last performed comparison.