mapx

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal added in v0.0.34

func Equal[K comparable, V any](x, y Map[K, V]) bool

func Keys added in v0.0.28

func Keys[K comparable, V any](m Map[K, V]) []K

func Len added in v0.0.28

func Len[K comparable, V any](m Map[K, V]) int

func Values added in v0.0.28

func Values[K comparable, V any](m Map[K, V]) []V

Types

type Map added in v0.0.28

type Map[K comparable, V any] interface {
	Exists(K) bool
	Load(K) (V, bool)
	LoadEq(func(any) bool) (V, bool)
	LoadEqs(func(any) bool) []V
	BatchLoad(...K) []Result[V]
	Store(K, V)
	BatchStore([]K, []V)
	LoadOrStore(K, V) (actual V, loaded bool)
	LoadAndDelete(K) (value V, loaded bool)
	Delete(K)
	BatchDelete(...K)
	Swap(K, V) (previous V, loaded bool)
	CompareAndSwap(key K, old, new V) (swapped bool)
	CompareAndDelete(key K, old V) (deleted bool)
	Range(func(key K, value V) (shouldContinue bool))
	Clear()
	Clone() Map[K, V]
}

func NewSafeXmap added in v0.0.34

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

func NewSmap added in v0.0.28

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

func NewXmap added in v0.0.28

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

func SafeWrap added in v0.0.34

func SafeWrap[K comparable, V any](m map[K]V) Map[K, V]

func Wrap added in v0.0.34

func Wrap[K comparable, V any](m map[K]V) Map[K, V]

type Result added in v0.0.28

type Result[V any] struct {
	V      V
	Loaded bool
}

type Set added in v0.0.34

type Set[K comparable] struct {
	// contains filtered or unexported fields
}

func NewSafeSet added in v0.0.34

func NewSafeSet[K comparable]() Set[K]

func NewSet added in v0.0.34

func NewSet[K comparable]() Set[K]

func (*Set[K]) Clear added in v0.0.34

func (s *Set[K]) Clear()

func (*Set[K]) Clone added in v0.0.34

func (s *Set[K]) Clone() Set[K]

func (*Set[K]) Delete added in v0.0.34

func (s *Set[K]) Delete(keys ...K)

func (*Set[K]) Equal added in v0.0.34

func (s *Set[K]) Equal(x Set[K]) bool

func (*Set[K]) Exists added in v0.0.34

func (s *Set[K]) Exists(k K) bool

func (*Set[K]) Keys added in v0.0.34

func (s *Set[K]) Keys() []K

func (*Set[K]) Len added in v0.0.34

func (s *Set[K]) Len() int

func (*Set[K]) Range added in v0.0.34

func (s *Set[K]) Range(f func(k K) bool)

func (*Set[K]) Store added in v0.0.34

func (s *Set[K]) Store(keys ...K)

Jump to

Keyboard shortcuts

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