Versions in this module Expand all Collapse all v0 v0.6.1 Aug 17, 2024 v0.6.0 Aug 14, 2024 Changes in this version + var ErrorPersistenceNotHasRecord = errors.New("persistence not has record") + type Event = any + type FunctionalStateConfigurator func(configuration *StateConfiguration) + func (f FunctionalStateConfigurator) Configure(configuration *StateConfiguration) + type FunctionalStorageProvider func() Storage + func (f FunctionalStorageProvider) Provide() Storage + type MemoryStorage struct + func NewMemoryStorage() *MemoryStorage + func (m *MemoryStorage) Clear(name Name) error + func (m *MemoryStorage) Load(name Name) (snapshot Snapshot, events []Event, err error) + func (m *MemoryStorage) Save(name Name, snapshot Snapshot, events []Event) error + type Name = string + type Snapshot = any + type State struct + func NewState(name Name, configurator ...StateConfigurator) *State + func (s *State) Clear() error + func (s *State) EventCount() int + func (s *State) Load() (snapshot Snapshot, events []Event, err error) + func (s *State) Persist() error + func (s *State) SaveSnapshot(snapshot Snapshot) + func (s *State) StateChanged(event Event) int + type StateConfiguration struct + func (c *StateConfiguration) WithStorage(storage Storage) *StateConfiguration + type StateConfigurator interface + Configure func(configuration *StateConfiguration) + type Storage interface + Clear func(name Name) error + Load func(name Name) (snapshot Snapshot, events []Event, err error) + Save func(name Name, snapshot Snapshot, events []Event) error + type StorageProvider interface + Provide func() Storage