Documentation ¶
Overview ¶
Package compare validates tuples against a schema.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Tuples ¶
Tuples checks if the candidate Tuple conforms to the given schema. The schema Tuple may contain Variable or MaybeMore while the candidate must not contain either. The elements of each Tuple are compared for equality. If an element of the schema Tuple is a Variable, then the candidate's corresponding element must conform for the constraints of the Variable. If all the elements match then nil is returned. If an element doesn't match, then an array is returned specifying the index path to the first mismatching element. For instance, given the following candidate tuple...
Tuple{55, Tuple{"hello", "world", Tuple{67}}}
...if the element with value `67` didn't match then the returned array would be `[]int{1,2,0}`. If the tuples aren't the same length then the length of the shorter Tuple is used as the mismatching index.
Types ¶
This section is empty.