deepcomp

package
v0.0.0-...-477bbb3 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MatchRegex  MatchType = "regex"
	MatchExact  MatchType = "exact"
	MatchSubset MatchType = "subset"
	MatchAbsent MatchType = "absent"

	ErrMissingField ErrorType = "ErrMissingField"
	ErrExtraField   ErrorType = "ErrExtraField"
	ErrTypeDiffers  ErrorType = "ErrTypeDiffers"
	ErrValueDiffers ErrorType = "ErrValueDiffers"
	ErrInvalidTypes ErrorType = "ErrInvalidTypes"
	ErrInvalidRegex ErrorType = "ErrInvalidRegex"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Diff

type Diff struct {
	Path    string
	Message string
	Type    ErrorType
	A       *reflect.Value
	B       *reflect.Value
}

func (Diff) String

func (diff Diff) String() string

type Diffset

type Diffset []Diff

func Absent

func Absent(expected, actual interface{}, matchType MatchType) Diffset

Like Subset, but matching fields error out, extra fields are ignored, and absent fields are OK

func Compare

func Compare(matchType MatchType, expected, actual interface{}) Diffset

func Exact

func Exact(expected, actual interface{}, matchType MatchType) Diffset

Match expected data against actual data, and return a set of all the differences.

func Subset

func Subset(expected, actual interface{}, matchType MatchType) Diffset

Like Exact, but filters out any extra fields not included in the expected data structure.

func (Diffset) Filter

func (diffs Diffset) Filter(errorType ErrorType) Diffset

func (Diffset) String

func (diffs Diffset) String() string

type ErrorType

type ErrorType string

type MatchType

type MatchType string

Jump to

Keyboard shortcuts

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