sync

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoWithWaitGroup added in v0.0.4

func GoWithWaitGroup(wg *sync.WaitGroup, block func())

GoWithWaitGroup runs the provided block function in a new goroutine and increments the WaitGroup counter while it's executing.

Types

type List

type List[K any] interface {
	Add(item K)
	RemoveAll(filter func(item K) bool) (removed bool)
	List() []K
	Size() int
	Sort(less func(i1, i2 K) bool)
}

func NewArrayList

func NewArrayList[V any]() List[V]

type ListMap

type ListMap[K comparable, V any] interface {
	Add(K, V) bool
	RemoveAll(K, func(V) bool) (bool, bool)
	Get(K) []V
	Keys() []K
	Sort(K, func(v1 V, v2 V) (less bool))
}

func NewListMap

func NewListMap[K comparable, V any]() ListMap[K, V]

type Map

type Map[K comparable, V any] interface {
	Put(k K, v V)
	Get(k K) (V, bool)
	Delete(k K) V
	Len() int
	Keys() []K
	Values() []V
	Clear()
}

func NewCacheMap

func NewCacheMap[K comparable, V any](expires time.Duration) Map[K, V]

func NewMap

func NewMap[K comparable, V any]() Map[K, V]

func NewVoidMap

func NewVoidMap[K comparable, V any]() Map[K, V]

Jump to

Keyboard shortcuts

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