set

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

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).

Jump to

Keyboard shortcuts

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