utils

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Map

func Map[T any, S any](in []T, fn func(t T) S) []S

func Reduce

func Reduce[T any, S any](in []T, acc S, fn func(t T, acc S) S) S

func SegmentKeys

func SegmentKeys[T comparable, S any, R any](mapA map[T]S, mapB map[T]R) (intersect, diffAB, diffBA []T)

SegmentKeys takes two maps with keys of the same type and returns three slices (with *no guaranteed order*): - the keys common across both maps - the keys present in the first set but not the second - the keys present in the second set but not the first

Types

type KeyValue

type KeyValue[T any, R any] struct {
	Key   T
	Value R
}

func NewKeyValue

func NewKeyValue[T any, R any](key T, value R) KeyValue[T, R]

Jump to

Keyboard shortcuts

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