xsync

package module
v0.0.0-...-98c7ffe Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: MIT Imports: 8 Imported by: 0

README

xsync

Golang package implements sync-primitives Map[K,T], Set[T] and others

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

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

A Map is a set of temporary objects that may be individually set, get and deleted.

A Map is safe for use by multiple goroutines simultaneously.

func NewMap

func NewMap[K comparable, T any](values map[K]T) Map[K, T]

func (*Map[K, T]) BinaryDecode

func (m *Map[K, T]) BinaryDecode(r io.Reader) error

func (*Map[K, T]) BinaryEncode

func (m *Map[K, T]) BinaryEncode(w io.Writer) error

func (*Map[K, T]) Clear

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

func (*Map[K, T]) Delete

func (m *Map[K, T]) Delete(key K)

func (*Map[K, T]) Exists

func (m *Map[K, T]) Exists(key K) bool

func (*Map[K, T]) Get

func (m *Map[K, T]) Get(key K) (_ T)

func (*Map[K, T]) GetOrSet

func (m *Map[K, T]) GetOrSet(key K, fn func() T) (res T)

func (*Map[K, T]) Increment

func (m *Map[K, T]) Increment(key K, val T) T

func (*Map[K, T]) KeyValues

func (m *Map[K, T]) KeyValues() map[K]T

func (*Map[K, T]) Keys

func (m *Map[K, T]) Keys() []K

func (*Map[K, T]) Len

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

func (*Map[K, T]) MarshalBinary

func (m *Map[K, T]) MarshalBinary() ([]byte, error)

func (*Map[K, T]) MarshalJSON

func (m *Map[K, T]) MarshalJSON() ([]byte, error)

func (*Map[K, T]) Pop

func (m *Map[K, T]) Pop() (key K, value T)

func (*Map[K, T]) PopAll

func (m *Map[K, T]) PopAll() (values map[K]T)

func (*Map[K, T]) Random

func (m *Map[K, T]) Random() (key K, value T)

func (*Map[K, T]) RandomKey

func (m *Map[K, T]) RandomKey() K

func (*Map[K, T]) RandomValue

func (m *Map[K, T]) RandomValue() T

func (*Map[K, T]) Set

func (m *Map[K, T]) Set(key K, value T)

func (*Map[K, T]) String

func (m *Map[K, T]) String() string

func (*Map[K, T]) UnmarshalBinary

func (m *Map[K, T]) UnmarshalBinary(data []byte) error

func (*Map[K, T]) UnmarshalJSON

func (m *Map[K, T]) UnmarshalJSON(data []byte) error

func (*Map[K, T]) Values

func (m *Map[K, T]) Values() []T

func (*Map[K, T]) Version

func (m *Map[K, T]) Version() uint64

type Set

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

A Set is a set of temporary objects that may be individually set, get and deleted.

A Set is safe for use by multiple goroutines simultaneously.

func NewSet

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

func (*Set[K]) BinaryDecode

func (m *Set[K]) BinaryDecode(r io.Reader) (err error)

func (*Set[K]) BinaryEncode

func (m *Set[K]) BinaryEncode(w io.Writer) error

func (*Set[K]) Clear

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

func (*Set[K]) Delete

func (m *Set[K]) Delete(key K)

func (*Set[K]) Exists

func (m *Set[K]) Exists(key K) bool

func (*Set[K]) MarshalJSON

func (m *Set[K]) MarshalJSON() ([]byte, error)

func (*Set[K]) Pop

func (m *Set[K]) Pop() (key K)

func (*Set[K]) PopAll

func (m *Set[K]) PopAll() (values []K)

func (*Set[K]) Random

func (m *Set[K]) Random() (key K)

func (*Set[K]) Set

func (m *Set[K]) Set(key K)

func (*Set[K]) Size

func (m *Set[K]) Size() int

func (*Set[K]) String

func (m *Set[K]) String() string

func (*Set[K]) Strings

func (m *Set[K]) Strings() []string

func (*Set[K]) UnmarshalJSON

func (m *Set[K]) UnmarshalJSON(data []byte) (err error)

func (*Set[K]) Values

func (m *Set[K]) Values() []K

func (*Set[K]) Version

func (m *Set[K]) Version() uint64

Jump to

Keyboard shortcuts

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