maps

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map[K comparable, V any] interface {
	Get(key K) (val V, ok bool)
	Set(key K, val V) (ok bool)
	Del(keys ...K)
	Iter() iter.Seq2[K, V]
	GetFull(key K) (val V, ok bool, valid bool)
}

func New

func New[K comparable, V any](isValid func(K, V) bool) Map[K, V]

type Sync

type Sync[K comparable, V any] struct {
	// contains filtered or unexported fields
}

Sync is a thread safe map wrapper.

func (*Sync[K, V]) Del

func (sm *Sync[K, V]) Del(keys ...K)

func (*Sync[K, V]) Get

func (sm *Sync[K, V]) Get(key K) (val V, ok bool)

func (*Sync[K, V]) GetFull

func (sm *Sync[K, V]) GetFull(key K) (val V, ok bool, valid bool)

func (*Sync[K, V]) Iter

func (sm *Sync[K, V]) Iter() iter.Seq2[K, V]

func (*Sync[K, V]) Len

func (sm *Sync[K, V]) Len() (i int)

func (*Sync[K, V]) Set

func (sm *Sync[K, V]) Set(key K, val V) (ok bool)

type Validated

type Validated[K comparable, V any] struct {
	*Sync[K, V]
	// contains filtered or unexported fields
}

func (*Validated[K, V]) Get

func (em *Validated[K, V]) Get(key K) (res V, ok bool)

func (*Validated[K, V]) GetFull

func (em *Validated[K, V]) GetFull(key K) (res V, ok bool, valid bool)

func (*Validated[K, V]) Iter

func (em *Validated[K, V]) Iter() iter.Seq2[K, V]

func (*Validated[K, V]) Set

func (em *Validated[K, V]) Set(key K, val V) (ok bool)

Jump to

Keyboard shortcuts

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