mapx

package
v1.0.1-rc5 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConflict = errors.Errorf("slice elements exsit conflict(s)")

Functions

func Eq

func Eq[T Comparable](a, b T) bool

func Get

func Get[T Comparable](a, b T) bool

func Gt

func Gt[T Comparable](a, b T) bool

func Let

func Let[T Comparable](a, b T) bool

func Lt

func Lt[T Comparable](a, b T) bool

func Neq

func Neq[T Comparable](a, b T) bool

Types

type Comparable

type Comparable interface {
	string |
		int | int8 | int16 | int32 | int64 |
		uint | uint8 | uint16 | uint32 | uint64 |
		float32 | float64
}

type Map

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

func New

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

func (*Map[K, V]) Clear added in v1.0.0

func (m *Map[K, V]) Clear()

func (*Map[K, V]) Len

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

func (*Map[K, V]) Load

func (m *Map[K, V]) Load(k K) (v V, ok bool)

func (*Map[K, V]) LoadAndRemove

func (m *Map[K, V]) LoadAndRemove(k K) (v V, ok bool)

func (*Map[K, V]) LoadOrStore

func (m *Map[K, V]) LoadOrStore(k K, newv func() (V, error)) (V, error)

func (*Map[K, V]) Range added in v1.1.0

func (m *Map[K, V]) Range(f func(k K, v V) bool)

func (*Map[K, V]) Remove

func (m *Map[K, V]) Remove(k K)

func (*Map[K, V]) Store

func (m *Map[K, V]) Store(k K, v V)

func (*Map[K, V]) StoreNX added in v1.0.0

func (m *Map[K, V]) StoreNX(k K, v V) bool

type Set

type Set[K comparable] map[K]bool

func ToSet

func ToSet[K comparable](vals []K, conv func(K) K) (s Set[K], err error)

Jump to

Keyboard shortcuts

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