Documentation
¶
Overview ¶
Package compare facilitates comparisons of any two values according to a set of specifications.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comparer ¶
type Comparer interface {
Compare(a, b interface{}) (result Comparison)
}
type Comparison ¶
type Comparison struct {
// contains filtered or unexported fields
}
func (Comparison) OK ¶
func (this Comparison) OK() bool
func (Comparison) Report ¶
func (this Comparison) Report() string
type DeepEquality ¶
type DeepEquality struct{}
DeepEquality compares any two values using reflect.DeepEqual. https://golang.org/pkg/reflect/#DeepEqual
func (DeepEquality) Compare ¶
func (this DeepEquality) Compare(a, b interface{}) bool
func (DeepEquality) IsSatisfiedBy ¶
func (this DeepEquality) IsSatisfiedBy(a, b interface{}) bool
type LengthEquality ¶
type LengthEquality struct{}
LengthEquality compares values that can serve as valid arguments to the built-in len function (with the exception of pointers to arrays, which are not yet supported herein). https://golang.org/pkg/builtin/#len
func (LengthEquality) Compare ¶
func (this LengthEquality) Compare(a, b interface{}) bool
func (LengthEquality) IsSatisfiedBy ¶
func (this LengthEquality) IsSatisfiedBy(a, b interface{}) bool
type NumericEquality ¶
type NumericEquality struct{}
NumericEquality compares numeric values using the built-in equality operator (`==`). Values of differing numeric reflect.Kind are each converted to the type of the other and are compared with `==` in both directions. https://golang.org/pkg/reflect/#Kind
func (NumericEquality) Compare ¶
func (this NumericEquality) Compare(a, b interface{}) bool
func (NumericEquality) IsSatisfiedBy ¶
func (this NumericEquality) IsSatisfiedBy(a, b interface{}) bool
type Option ¶
type Option func(*config)
func FormatJSON ¶
func FormatLength ¶
func FormatLength() Option
func FormatVerb ¶
func With ¶
func With(specs ...Specification) Option
type SimpleEquality ¶
type SimpleEquality struct{}
SimpleEquality compares any two values using the built-in equality operator (`==`). https://golang.org/ref/spec#Comparison_operators
func (SimpleEquality) Compare ¶
func (this SimpleEquality) Compare(a, b interface{}) bool
func (SimpleEquality) IsSatisfiedBy ¶
func (this SimpleEquality) IsSatisfiedBy(a, b interface{}) bool
type Specification ¶
type TimeEquality ¶
type TimeEquality struct{}
TimeEquality compares values both of type time.Time using their Equal method. https://golang.org/pkg/time/#Time.Equal
func (TimeEquality) Compare ¶
func (this TimeEquality) Compare(a, b interface{}) bool
func (TimeEquality) IsSatisfiedBy ¶
func (this TimeEquality) IsSatisfiedBy(a, b interface{}) bool