genericz

package module
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: BSD-2-Clause Imports: 1 Imported by: 0

README

genericz - convenience made possible since generics

The main package only contains Min(a ...T) T and Max(a ...T) T.

The packages below are intended to contain additions to golang.org/x/exp/slices and golang.org/x/exp/maps and thus won't be the full set that you need. (Over time there will be overlap as we won't remove methods as it would break backwards compatibility.)

mapz

The mapz package contains:

  • KeysSorted(m map[K]V) []K and ValuesSorted(m map[K]V) []V
  • MinKey(m map[K]V) K and MaxKey(m map[K]V) K
  • DeleteWithLock(l sync.Locker, m map[K]V, key K) and StoreWithLock(l sync.Locker, m map[K]V, key K, value V)

The SyncMap is a type-safe sync.Map.

The MutexMap is a variant of SyncMap that uses a mutex and a regular map.

slicez

The slicez packages contains Diff, Filter, Unique, Concat and Sum.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Max

func Max[T constraints.Ordered](a ...T) T

Max returns the highest value given.

func Min

func Min[T constraints.Ordered](a ...T) T

Min returns the lowest value given.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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