sync

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 6 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[T any] interface {
	Set(key string, data T)
	Get(key string) (data T, ok bool)
	GetOrInit(key string, init func() T) (data T, isNew bool)
	GetMap() map[string]T
	Delete(key string)
	CompareAndSwap(key string, n T, swap func(stored T) bool) (swapped bool)
}

func NewMap

func NewMap[T any]() Map[T]

type Obj

type Obj[T any] interface {
	Set(data T)
	Get() (data T)
	Swap(inn T) (out T)
}

func NewObj

func NewObj[T any]() Obj[T]

type Que

type Que[T any] interface {
	Push(data T)
	Pop() (data T, ok bool)
	Peek() (data T, ok bool)
	Delete(is func(v T) bool)
	HasData() <-chan struct{}
}

func NewQue

func NewQue[T any]() Que[T]

type SLK

type SLK interface {
	Add(key string, timeout time.Duration)
	Get(key string) (ok bool)
	Delete(key string)
}

func NewSLK

func NewSLK() SLK

type Slice

type Slice[T any] interface {
	Add(data T)
	Set(i int, data T)
	Get(i int) (data T, ok bool)
	Contains(val T) int
	Slice() []T
	Delete(i int) T
}

Not sure i want to use comparable here

func NewSlice

func NewSlice[T any]() Slice[T]

type Stack

type Stack[T any] interface {
	Push(data T)
	Pop() (data T, ok bool)
	Peek() (data T, ok bool)
}

func NewStack

func NewStack[T any]() Stack[T]

Jump to

Keyboard shortcuts

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