Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Intersection ¶
func Intersection(left, right interface{}) [][]Identifiable
Intersection returns all 'Identifiable' elements from 'left' and 'right' slice that intersect by 'Identifier()' value. Each intersection is represented as a tuple of two elements - matching elements from 'left' and 'right'. Note, that despite the parameters being declared as 'interface{}' they must contain only the elements implementing 'Identifiable' interface (this is needed to solve lack of covariance in Go)
Types ¶
type Identifiable ¶
type Identifiable interface {
Identifier() interface{}
}
Identifiable is a simple interface wrapping any object which has some key field which can be used for later aggregation operations (grouping, intersection, difference etc)
func Difference ¶
func Difference(left, right interface{}) []Identifiable
Difference returns all 'Identifiable' elements that are in left slice and not in the right one. Note, that despite the parameters being declared as 'interface{}' they must contain only the elements implementing 'Identifiable' interface (this is needed to solve lack of covariance in Go).