storage

package
v0.0.0-...-cd40d76 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcurrentSlice

type ConcurrentSlice struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ConcurrentSlice is a slice which is safe for usage in multiple goroutines. It can only hold items which have function ID() uuid.UUID

func New

func New() ConcurrentSlice

New returns an empty ConcurrentSlice

func (*ConcurrentSlice) Append

func (cs *ConcurrentSlice) Append(item itemWithID)

Append appends item to ConcurrentSlice

func (*ConcurrentSlice) CurrentItems

func (cs *ConcurrentSlice) CurrentItems() []itemWithID

CurrentItems returns a normal slice of items in ConcurrentSlice

func (*ConcurrentSlice) DeleteByID

func (cs *ConcurrentSlice) DeleteByID(id uuid.UUID) bool

DeleteByID deletes item with correspondind ID from slice

func (*ConcurrentSlice) Get

func (cs *ConcurrentSlice) Get(idx int) (itemWithID, bool)

Get returns item from ConcurrentSlice with given index

func (*ConcurrentSlice) GetByID

func (cs *ConcurrentSlice) GetByID(id uuid.UUID) (itemWithID, bool)

GetByID returns item from ConcurrentSlice with given id

func (*ConcurrentSlice) Len

func (cs *ConcurrentSlice) Len() int

Len returns length of ConcurrentSlice

Jump to

Keyboard shortcuts

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