orderedstore

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OrderedStore

type OrderedStore[T any] struct {
	sync.RWMutex

	// Whether or not to track in this state
	Disabled bool
	// contains filtered or unexported fields
}

An orderedstore is a basic store that preserves insert order by using an orderedmap instead of a map

func (*OrderedStore[T]) Delete

func (s *OrderedStore[T]) Delete(id string) error

Delete an entity from the state

func (*OrderedStore[T]) Get

func (s *OrderedStore[T]) Get(id string) (*T, error)

func (*OrderedStore[T]) Init

func (s *OrderedStore[T]) Init() *OrderedStore[T]

Initialize the state

func (*OrderedStore[T]) Length

func (s *OrderedStore[T]) Length() int

Returns the length of the store

func (*OrderedStore[T]) Set

func (s *OrderedStore[T]) Set(id string, entity *T) error

Set an entity in the state

func (*OrderedStore[T]) Usable

func (s *OrderedStore[T]) Usable() bool

Is the state usable

Jump to

Keyboard shortcuts

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