Documentation
¶
Overview ¶
Package value defines helper functions to compare numeric and other value types as either ordered or unordered. It also contains helpers to perform set operations on collections, and find sub-sequences in sequences.
Index ¶
- func AsFloat(value interface{}) (float64, bool)
- func AsInt(value interface{}) (int64, bool)
- func AsUInt(value interface{}) (uint64, bool)
- func CompareOrdered(lhs, rhs interface{}) (int, error)
- func CompareUnordered(lhs, rhs interface{}) (bool, error)
- func FormatSetValues(s Set) string
- func IndexOfSubsequence(seq, sub reflect.Value) int
- func IsSequenceType(v reflect.Value) bool
- func MaxAbsoluteDifference(lhs, rhs interface{}) (float64, error)
- func PreCheckSubsequence(v1, v2 reflect.Value) error
- type Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareOrdered ¶
CompareOrdered returns the result of the comparison of two values of compatible type that can be ordered, including ints, floats, strings, byte slices, and slices of comparable orderable values. Values of different type or values of the same type that cannot be ordered return an error.
func CompareUnordered ¶
CompareUnordered returns the result of the equality comparison of two values of compatible type, including ints, floats, strings and slices of comparable values. Other values are compared with reflect.DeepEqual(). Values of different tyype that cannot be compared return an error.
func FormatSetValues ¶ added in v0.5.0
func IndexOfSubsequence ¶ added in v0.5.0
func IsSequenceType ¶ added in v0.5.0
func MaxAbsoluteDifference ¶
MaxAbsoluteDifference returns the maximum absolute difference of all the components. Both values must have the same shape and must be composed of values convertible to float64 for comparison