basicstore

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 BasicStore

type BasicStore[T any] struct {
	sync.RWMutex

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

Simple implementation of state

This uses a sync.RWMutex to be able to handle concurrent writes

func (*BasicStore[T]) Delete

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

Delete an entity from the state

func (*BasicStore[T]) Get

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

Get an entity from the state

func (*BasicStore[T]) Init

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

Initialize the state, not needed by Store interface but needed for this specific store

func (*BasicStore[T]) KeyValuePairs

func (s *BasicStore[T]) KeyValuePairs() []string

Print list of key/value pairs, not needed by Store interface

func (*BasicStore[T]) Length

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

Returns the length of the store

func (*BasicStore[T]) Set

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

Set an entity in the state

func (*BasicStore[T]) Usable

func (s *BasicStore[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