mapdiff

package
v0.0.0-...-7b2e207 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2018 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiffType

type DiffType string

DiffType represents a difference type

const DiffTypeDifferent DiffType = "different"

DiffTypeDifferent represents a difference type that represents a difference between two fields

const DiffTypeMissing DiffType = "missing"

DiffTypeMissing is a difference type that represents a missing field

type DiffValue

type DiffValue struct {
	AffectedField []interface{}
	Type          DiffType
	LongestMap    Map
	AffectedMap   Map
}

DiffValue represents a difference

type Map

type Map struct {
	Value map[string]interface{}
	Name  string
}

Map defines a structure for representing the maps to check

type MapDiff

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

MapDiff defines a structure that performs shallow difference checks between one main map and other maps

func NewMapDiff

func NewMapDiff(m Map, against ...Map) *MapDiff

NewMapDiff creates an new instance of MapDiff to perform difference checks between a map type and one or more others

func (*MapDiff) Diff

func (s *MapDiff) Diff() [][]DiffValue

Diff checks the main map against the other map(s) and returns the difference for each map. If there is no difference between the main map and a map being compared, nil is included in the corresponding index of the checked map.

func (*MapDiff) Difference

func (s *MapDiff) Difference() []bool

Difference checks whether the main map is different from the other maps

Jump to

Keyboard shortcuts

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