Documentation ¶
Index ¶
- type BasicStore
- func (s *BasicStore[T]) Delete(id string) error
- func (s *BasicStore[T]) Get(id string) (*T, error)
- func (s *BasicStore[T]) Init() *BasicStore[T]
- func (s *BasicStore[T]) KeyValuePairs() []string
- func (s *BasicStore[T]) Length() int
- func (s *BasicStore[T]) Set(id string, entity *T) error
- func (s *BasicStore[T]) Usable() bool
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]) Set ¶
func (s *BasicStore[T]) Set(id string, entity *T) error
Set an entity in the state
Click to show internal directories.
Click to hide internal directories.