Documentation
¶
Index ¶
- func Dereference[E any](list []*E) []E
- func Filter[E any](input []E, predicate func(E) bool) []E
- func FilterInPlace[E any](list []*E, predicate func(*E) bool) []*E
- func MergeMaps(map1, map2 map[string]string) (map[string]string, bool)
- func MergeMapsSilent(map1, map2 map[string]string) map[string]string
- type DiffCalc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dereference ¶
func Dereference[E any](list []*E) []E
Dereference is a function that dereferences elements of a provided slice of pointers.
func Filter ¶
Filter returns a new slice which results from applying the provided predicate to the input slice.
func FilterInPlace ¶
FilterInPlace modifies a slice using provided predicate function. It returns a sub-slice of the input list that only contains the elements for which the predicate function returns true. Warning: This function modifies the input list!
Types ¶
type DiffCalc ¶
DiffCalc calculates the difference between two slices of objects for which a string-based identity can be defined. The provided identity function should return the smallest unique string representation of the object. Note: For most types one can find a unique string identity, but for some types it might not be possible or practical: one example would be a built-in map[k]v type.
In such cases, the DiffCalc type should not be used.
func (*DiffCalc[E]) NotExistingIn ¶
func (d *DiffCalc[E]) NotExistingIn(second []E) []*E
notExistingIn returns a slice of object that are present in the first slice but not in the second. The returned list is a slice of pointers to the objects in the first slice, to avoid copying the objects.