Documentation ¶
Index ¶
- Constants
- func LogHistoryOnFailure(tb testingTB, el EventViewer)
- type Event
- type EventLog
- func (el *EventLog) Append(ctx context.Context, event Event) error
- func (el *EventLog) Atomic(ctx context.Context, fn func(tx *EventLogTx) error) error
- func (el *EventLog) BeginTx(ctx context.Context) (context.Context, error)
- func (el *EventLog) CommitTx(ctx context.Context) error
- func (el *EventLog) Compress()
- func (el *EventLog) Events() []Event
- func (el *EventLog) LookupMeta(ctx context.Context, key string, ptr interface{}) (_found bool, _err error)
- func (el *EventLog) LookupTx(ctx context.Context) (*EventLogTx, bool)
- func (el *EventLog) Rewrite(mapper func(es []Event) []Event)
- func (el *EventLog) RollbackTx(ctx context.Context) error
- func (el *EventLog) SetMeta(ctx context.Context, key string, value interface{}) (context.Context, error)
- func (el *EventLog) Subscribe(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
- type EventLogEvent
- type EventLogStorage
- func (s *EventLogStorage) BeginTx(ctx context.Context) (context.Context, error)
- func (s *EventLogStorage) CommitTx(ctx context.Context) error
- func (s *EventLogStorage) Compress()
- func (s *EventLogStorage) Create(ctx context.Context, ptr interface{}) error
- func (s *EventLogStorage) DeleteAll(ctx context.Context) error
- func (s *EventLogStorage) DeleteByID(ctx context.Context, id interface{}) error
- func (s *EventLogStorage) FindAll(ctx context.Context) frameless.Iterator
- func (s *EventLogStorage) FindByID(ctx context.Context, ptr interface{}, id interface{}) (_found bool, _err error)
- func (s *EventLogStorage) FindByIDs(ctx context.Context, ids ...interface{}) frameless.Iterator
- func (s *EventLogStorage) GetNamespace() string
- func (s *EventLogStorage) LookupTx(ctx context.Context) (*EventLogTx, bool)
- func (s *EventLogStorage) RollbackTx(ctx context.Context) error
- func (s *EventLogStorage) SubscribeToCreate(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
- func (s *EventLogStorage) SubscribeToCreatorEvents(ctx context.Context, subscriber frameless.CreatorSubscriber) (frameless.Subscription, error)
- func (s *EventLogStorage) SubscribeToDeleteAll(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
- func (s *EventLogStorage) SubscribeToDeleteByID(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
- func (s *EventLogStorage) SubscribeToDeleterEvents(ctx context.Context, subscriber frameless.DeleterSubscriber) (frameless.Subscription, error)
- func (s *EventLogStorage) SubscribeToUpdate(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
- func (s *EventLogStorage) SubscribeToUpdaterEvents(ctx context.Context, subscriber frameless.UpdaterSubscriber) (frameless.Subscription, error)
- func (s *EventLogStorage) Update(ctx context.Context, ptr interface{}) error
- func (s *EventLogStorage) Upsert(ctx context.Context, ptrs ...interface{}) (rErr error)
- func (s *EventLogStorage) View(ctx context.Context) StorageView
- type EventLogStorageEvent
- type EventLogSubscriber
- type EventLogTx
- type EventManager
- type EventViewer
- type Memory
- func (m *Memory) All(T frameless.T, ctx context.Context, namespace string) frameless.Iterator
- func (m *Memory) BeginTx(ctx context.Context) (context.Context, error)
- func (m *Memory) CommitTx(ctx context.Context) error
- func (m *Memory) Del(ctx context.Context, namespace string, key string) bool
- func (m *Memory) Get(ctx context.Context, namespace string, key string) (interface{}, bool)
- func (m *Memory) LookupMeta(ctx context.Context, key string, ptr interface{}) (_found bool, _err error)
- func (m *Memory) LookupTx(ctx context.Context) (*MemoryTx, bool)
- func (m *Memory) RollbackTx(ctx context.Context) error
- func (m *Memory) Set(ctx context.Context, namespace, key string, value interface{})
- func (m *Memory) SetMeta(ctx context.Context, key string, value interface{}) (context.Context, error)
- type MemoryNamespace
- type MemoryTx
- type Stack
- type Storage
- func (s *Storage) Create(ctx context.Context, ptr interface{}) error
- func (s *Storage) DeleteAll(ctx context.Context) error
- func (s *Storage) DeleteByID(ctx context.Context, id interface{}) error
- func (s *Storage) FindAll(ctx context.Context) frameless.Iterator
- func (s *Storage) FindByID(ctx context.Context, ptr, id interface{}) (found bool, err error)
- func (s *Storage) FindByIDs(ctx context.Context, ids ...interface{}) frameless.Iterator
- func (s *Storage) GetNamespace() string
- func (s *Storage) IDToMemoryKey(id frameless.T) string
- func (s *Storage) Update(ctx context.Context, ptr interface{}) error
- func (s *Storage) Upsert(ctx context.Context, ptrs ...interface{}) error
- type StorageView
- type Subscription
- type Traceable
Constants ¶
View Source
const ( CreateEvent = `Create` UpdateEvent = `Update` DeleteAllEvent = `DeleteAll` DeleteByIDEvent = `DeleteByID` )
Name Types
Variables ¶
This section is empty.
Functions ¶
func LogHistoryOnFailure ¶ added in v0.41.0
func LogHistoryOnFailure(tb testingTB, el EventViewer)
Types ¶
type EventLog ¶ added in v0.36.0
type EventLog struct { Options struct { DisableAsyncSubscriptionHandling bool } // contains filtered or unexported fields }
EventLog is an event source principles based development in memory memory, that allows easy debugging and tracing during development for fast and descriptive feedback loops.
func NewEventLog ¶ added in v0.36.0
func NewEventLog() *EventLog
func (*EventLog) LookupMeta ¶ added in v0.43.1
func (*EventLog) LookupTx ¶ added in v0.36.0
func (el *EventLog) LookupTx(ctx context.Context) (*EventLogTx, bool)
func (*EventLog) RollbackTx ¶ added in v0.36.0
func (*EventLog) Subscribe ¶ added in v0.41.0
func (el *EventLog) Subscribe(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
type EventLogEvent ¶ added in v0.41.0
func (EventLogEvent) GetTrace ¶ added in v0.41.0
func (et EventLogEvent) GetTrace() []Stack
func (EventLogEvent) SetTrace ¶ added in v0.41.0
func (et EventLogEvent) SetTrace(trace []Stack)
func (EventLogEvent) String ¶ added in v0.41.0
func (et EventLogEvent) String() string
type EventLogStorage ¶ added in v0.41.0
type EventLogStorage struct { T interface{} EventLog *EventLog NewID func(ctx context.Context) (interface{}, error) // Namespace separates different storage events in the event log. // By default same entities reside under the same Namespace through their fully qualified name used as namespace ID. // If you want create multiple EventLogStorage that works with the same entity but act as separate storages, // you need to assign a unique Namespace for each of these EventLogStorage. Namespace string Options struct { CompressEventLog bool } // contains filtered or unexported fields }
EventLogStorage is an EventLog based development in memory storage, that allows easy debugging and tracing during development for fast and descriptive feedback loops.
func NewEventLogStorage ¶ added in v0.41.0
func NewEventLogStorage(T interface{}, m *EventLog) *EventLogStorage
func NewEventLogStorageWithNamespace ¶ added in v0.43.0
func NewEventLogStorageWithNamespace(T interface{}, m *EventLog, ns string) *EventLogStorage
func (*EventLogStorage) CommitTx ¶ added in v0.41.0
func (s *EventLogStorage) CommitTx(ctx context.Context) error
func (*EventLogStorage) Compress ¶ added in v0.41.0
func (s *EventLogStorage) Compress()
func (*EventLogStorage) Create ¶ added in v0.41.0
func (s *EventLogStorage) Create(ctx context.Context, ptr interface{}) error
func (*EventLogStorage) DeleteAll ¶ added in v0.41.0
func (s *EventLogStorage) DeleteAll(ctx context.Context) error
func (*EventLogStorage) DeleteByID ¶ added in v0.41.0
func (s *EventLogStorage) DeleteByID(ctx context.Context, id interface{}) error
func (*EventLogStorage) FindAll ¶ added in v0.41.0
func (s *EventLogStorage) FindAll(ctx context.Context) frameless.Iterator
func (*EventLogStorage) FindByID ¶ added in v0.41.0
func (s *EventLogStorage) FindByID(ctx context.Context, ptr interface{}, id interface{}) (_found bool, _err error)
func (*EventLogStorage) FindByIDs ¶ added in v0.41.0
func (s *EventLogStorage) FindByIDs(ctx context.Context, ids ...interface{}) frameless.Iterator
func (*EventLogStorage) GetNamespace ¶ added in v0.43.0
func (s *EventLogStorage) GetNamespace() string
func (*EventLogStorage) LookupTx ¶ added in v0.41.0
func (s *EventLogStorage) LookupTx(ctx context.Context) (*EventLogTx, bool)
func (*EventLogStorage) RollbackTx ¶ added in v0.41.0
func (s *EventLogStorage) RollbackTx(ctx context.Context) error
func (*EventLogStorage) SubscribeToCreate ¶ added in v0.41.0
func (s *EventLogStorage) SubscribeToCreate(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
func (*EventLogStorage) SubscribeToCreatorEvents ¶ added in v0.54.0
func (s *EventLogStorage) SubscribeToCreatorEvents(ctx context.Context, subscriber frameless.CreatorSubscriber) (frameless.Subscription, error)
func (*EventLogStorage) SubscribeToDeleteAll ¶ added in v0.41.0
func (s *EventLogStorage) SubscribeToDeleteAll(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
func (*EventLogStorage) SubscribeToDeleteByID ¶ added in v0.41.0
func (s *EventLogStorage) SubscribeToDeleteByID(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
func (*EventLogStorage) SubscribeToDeleterEvents ¶ added in v0.54.0
func (s *EventLogStorage) SubscribeToDeleterEvents(ctx context.Context, subscriber frameless.DeleterSubscriber) (frameless.Subscription, error)
func (*EventLogStorage) SubscribeToUpdate ¶ added in v0.41.0
func (s *EventLogStorage) SubscribeToUpdate(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
func (*EventLogStorage) SubscribeToUpdaterEvents ¶ added in v0.54.0
func (s *EventLogStorage) SubscribeToUpdaterEvents(ctx context.Context, subscriber frameless.UpdaterSubscriber) (frameless.Subscription, error)
func (*EventLogStorage) Update ¶ added in v0.41.0
func (s *EventLogStorage) Update(ctx context.Context, ptr interface{}) error
func (*EventLogStorage) Upsert ¶ added in v0.41.0
func (s *EventLogStorage) Upsert(ctx context.Context, ptrs ...interface{}) (rErr error)
func (*EventLogStorage) View ¶ added in v0.41.0
func (s *EventLogStorage) View(ctx context.Context) StorageView
type EventLogStorageEvent ¶ added in v0.41.0
type EventLogStorageEvent struct { Namespace string T interface{} Name string Value interface{} Trace []Stack }
func (EventLogStorageEvent) GetTrace ¶ added in v0.41.0
func (e EventLogStorageEvent) GetTrace() []Stack
func (EventLogStorageEvent) SetTrace ¶ added in v0.41.0
func (e EventLogStorageEvent) SetTrace(trace []Stack)
func (EventLogStorageEvent) String ¶ added in v0.41.0
func (e EventLogStorageEvent) String() string
type EventLogSubscriber ¶ added in v0.54.0
type EventLogSubscriber interface { // Handle handles the the subscribed event. // Context may or may not have meta information about the received event. // To ensure expectations, define a resource specification <contract> about what must be included in the context. Handle(ctx context.Context, event interface{}) error // Error allow the subscription implementation to be notified about unexpected situations // that needs to be handled by the subscriber. // For e.g. the connection is lost and the subscriber might have cached values // that must be invalidated on the next successful Handle call HandleError(ctx context.Context, err error) error }
type EventLogTx ¶ added in v0.41.0
type EventLogTx struct {
// contains filtered or unexported fields
}
func (*EventLogTx) Append ¶ added in v0.41.0
func (tx *EventLogTx) Append(ctx context.Context, event Event) error
func (*EventLogTx) Events ¶ added in v0.41.0
func (tx *EventLogTx) Events() []Event
type EventManager ¶ added in v0.36.0
type EventManager interface { Append(context.Context, Event) error EventViewer }
type EventViewer ¶ added in v0.36.0
type EventViewer interface {
Events() []Event
}
type Memory ¶ added in v0.41.0
type Memory struct {
// contains filtered or unexported fields
}
func (*Memory) LookupMeta ¶ added in v0.43.1
type MemoryNamespace ¶ added in v0.41.0
type MemoryNamespace map[string]interface{}
type Storage ¶
type Storage struct { T frameless.T Memory *Memory NewID func(context.Context) (interface{}, error) Namespace string // contains filtered or unexported fields }
func NewStorageWithNamespace ¶ added in v0.43.0
func (*Storage) DeleteByID ¶
func (*Storage) GetNamespace ¶ added in v0.43.0
func (*Storage) IDToMemoryKey ¶ added in v0.41.0
type StorageView ¶ added in v0.36.0
type StorageView map[string]interface{}
func (StorageView) FindByID ¶ added in v0.36.0
func (v StorageView) FindByID(id interface{}) (interface{}, bool)
type Subscription ¶ added in v0.36.0
type Subscription struct {
// contains filtered or unexported fields
}
func (*Subscription) Close ¶ added in v0.36.0
func (s *Subscription) Close() (rErr error)
Click to show internal directories.
Click to hide internal directories.