Documentation ¶
Index ¶
- Constants
- func LogHistoryOnFailure(tb testingTB, el EventViewer)
- func RewriteEventLog[EventType any](el *EventLog, rewrite func(es []EventType) []EventType)
- 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) EventsInContext(ctx context.Context) []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[Ent, ID]) BeginTx(ctx context.Context) (context.Context, error)
- func (s *EventLogStorage[Ent, ID]) CommitTx(ctx context.Context) error
- func (s *EventLogStorage[Ent, ID]) Compress()
- func (s *EventLogStorage[Ent, ID]) Create(ctx context.Context, ptr *Ent) error
- func (s *EventLogStorage[Ent, ID]) DeleteAll(ctx context.Context) error
- func (s *EventLogStorage[Ent, ID]) DeleteByID(ctx context.Context, id ID) error
- func (s *EventLogStorage[Ent, ID]) Events(ctx context.Context) []EventLogStorageEvent[Ent, ID]
- func (s *EventLogStorage[Ent, ID]) FindAll(ctx context.Context) frameless.Iterator[Ent]
- func (s *EventLogStorage[Ent, ID]) FindByID(ctx context.Context, ptr *Ent, id ID) (_found bool, _err error)
- func (s *EventLogStorage[Ent, ID]) FindByIDs(ctx context.Context, ids ...ID) frameless.Iterator[Ent]
- func (s *EventLogStorage[Ent, ID]) GetNamespace() string
- func (s *EventLogStorage[Ent, ID]) LookupTx(ctx context.Context) (*EventLogTx, bool)
- func (s *EventLogStorage[Ent, ID]) RollbackTx(ctx context.Context) error
- func (s *EventLogStorage[Ent, ID]) SubscribeToCreate(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
- func (s *EventLogStorage[Ent, ID]) SubscribeToCreatorEvents(ctx context.Context, subscriber frameless.CreatorSubscriber[Ent]) (frameless.Subscription, error)
- func (s *EventLogStorage[Ent, ID]) SubscribeToDeleteAll(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
- func (s *EventLogStorage[Ent, ID]) SubscribeToDeleteByID(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
- func (s *EventLogStorage[Ent, ID]) SubscribeToDeleterEvents(ctx context.Context, subscriber frameless.DeleterSubscriber[ID]) (frameless.Subscription, error)
- func (s *EventLogStorage[Ent, ID]) SubscribeToUpdate(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
- func (s *EventLogStorage[Ent, ID]) SubscribeToUpdaterEvents(ctx context.Context, subscriber frameless.UpdaterSubscriber[Ent]) (frameless.Subscription, error)
- func (s *EventLogStorage[Ent, ID]) Update(ctx context.Context, ptr *Ent) error
- func (s *EventLogStorage[Ent, ID]) Upsert(ctx context.Context, ptrs ...*Ent) (rErr error)
- func (s *EventLogStorage[Ent, ID]) View(ctx context.Context) StorageView[Ent, ID]
- type EventLogStorageEvent
- type EventLogSubscriber
- type EventLogTx
- type EventManager
- type EventViewer
- type Memory
- func (m *Memory) All(T frameless.T, ctx context.Context, namespace string) (sliceOfT interface{})
- 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[Ent, ID]) Create(ctx context.Context, ptr *Ent) error
- func (s *Storage[Ent, ID]) DeleteAll(ctx context.Context) error
- func (s *Storage[Ent, ID]) DeleteByID(ctx context.Context, id ID) error
- func (s *Storage[Ent, ID]) FindAll(ctx context.Context) frameless.Iterator[Ent]
- func (s *Storage[Ent, ID]) FindByID(ctx context.Context, ptr *Ent, id ID) (found bool, err error)
- func (s *Storage[Ent, ID]) FindByIDs(ctx context.Context, ids ...ID) frameless.Iterator[Ent]
- func (s *Storage[Ent, ID]) GetNamespace() string
- func (s *Storage[Ent, ID]) IDToMemoryKey(id frameless.T) string
- func (s *Storage[Ent, ID]) MakeID(ctx context.Context) (ID, error)
- func (s *Storage[Ent, ID]) Update(ctx context.Context, ptr *Ent) error
- func (s *Storage[Ent, ID]) Upsert(ctx context.Context, ptrs ...*Ent) 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.63.0
func LogHistoryOnFailure(tb testingTB, el EventViewer)
func RewriteEventLog ¶ added in v0.63.0
Types ¶
type EventLog ¶ added in v0.63.0
type EventLog struct { Options struct { DisableAsyncSubscriptionHandling bool } // contains filtered or unexported fields }
EventLog is an event source principles based in memory resource, that allows easy debugging and tracing during development for fast and descriptive feedback loops.
func NewEventLog ¶ added in v0.63.0
func NewEventLog() *EventLog
func (*EventLog) EventsInContext ¶ added in v0.63.0
func (*EventLog) LookupMeta ¶ added in v0.63.0
func (*EventLog) LookupTx ¶ added in v0.63.0
func (el *EventLog) LookupTx(ctx context.Context) (*EventLogTx, bool)
func (*EventLog) RollbackTx ¶ added in v0.63.0
func (*EventLog) Subscribe ¶ added in v0.63.0
func (el *EventLog) Subscribe(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
type EventLogEvent ¶ added in v0.63.0
func (EventLogEvent) GetTrace ¶ added in v0.63.0
func (et EventLogEvent) GetTrace() []Stack
func (EventLogEvent) SetTrace ¶ added in v0.63.0
func (et EventLogEvent) SetTrace(trace []Stack)
func (EventLogEvent) String ¶ added in v0.63.0
func (et EventLogEvent) String() string
type EventLogStorage ¶ added in v0.63.0
type EventLogStorage[Ent, ID any] struct { EventLog *EventLog MakeID func(ctx context.Context) (ID, 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.63.0
func NewEventLogStorage[Ent, ID any](m *EventLog) *EventLogStorage[Ent, ID]
func NewEventLogStorageWithNamespace ¶ added in v0.63.0
func NewEventLogStorageWithNamespace[Ent, ID any](m *EventLog, ns string) *EventLogStorage[Ent, ID]
func (*EventLogStorage[Ent, ID]) CommitTx ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) CommitTx(ctx context.Context) error
func (*EventLogStorage[Ent, ID]) Compress ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) Compress()
func (*EventLogStorage[Ent, ID]) Create ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) Create(ctx context.Context, ptr *Ent) error
func (*EventLogStorage[Ent, ID]) DeleteAll ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) DeleteAll(ctx context.Context) error
func (*EventLogStorage[Ent, ID]) DeleteByID ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) DeleteByID(ctx context.Context, id ID) error
func (*EventLogStorage[Ent, ID]) Events ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) Events(ctx context.Context) []EventLogStorageEvent[Ent, ID]
func (*EventLogStorage[Ent, ID]) FindAll ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) FindAll(ctx context.Context) frameless.Iterator[Ent]
func (*EventLogStorage[Ent, ID]) FindByID ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) FindByID(ctx context.Context, ptr *Ent, id ID) (_found bool, _err error)
func (*EventLogStorage[Ent, ID]) FindByIDs ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) FindByIDs(ctx context.Context, ids ...ID) frameless.Iterator[Ent]
func (*EventLogStorage[Ent, ID]) GetNamespace ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) GetNamespace() string
func (*EventLogStorage[Ent, ID]) LookupTx ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) LookupTx(ctx context.Context) (*EventLogTx, bool)
func (*EventLogStorage[Ent, ID]) RollbackTx ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) RollbackTx(ctx context.Context) error
func (*EventLogStorage[Ent, ID]) SubscribeToCreate ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) SubscribeToCreate(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
func (*EventLogStorage[Ent, ID]) SubscribeToCreatorEvents ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) SubscribeToCreatorEvents(ctx context.Context, subscriber frameless.CreatorSubscriber[Ent]) (frameless.Subscription, error)
func (*EventLogStorage[Ent, ID]) SubscribeToDeleteAll ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) SubscribeToDeleteAll(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
func (*EventLogStorage[Ent, ID]) SubscribeToDeleteByID ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) SubscribeToDeleteByID(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
func (*EventLogStorage[Ent, ID]) SubscribeToDeleterEvents ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) SubscribeToDeleterEvents(ctx context.Context, subscriber frameless.DeleterSubscriber[ID]) (frameless.Subscription, error)
func (*EventLogStorage[Ent, ID]) SubscribeToUpdate ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) SubscribeToUpdate(ctx context.Context, subscriber EventLogSubscriber) (frameless.Subscription, error)
func (*EventLogStorage[Ent, ID]) SubscribeToUpdaterEvents ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) SubscribeToUpdaterEvents(ctx context.Context, subscriber frameless.UpdaterSubscriber[Ent]) (frameless.Subscription, error)
func (*EventLogStorage[Ent, ID]) Update ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) Update(ctx context.Context, ptr *Ent) error
func (*EventLogStorage[Ent, ID]) Upsert ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) Upsert(ctx context.Context, ptrs ...*Ent) (rErr error)
func (*EventLogStorage[Ent, ID]) View ¶ added in v0.63.0
func (s *EventLogStorage[Ent, ID]) View(ctx context.Context) StorageView[Ent, ID]
type EventLogStorageEvent ¶ added in v0.63.0
type EventLogStorageEvent[Ent, ID any] struct { Namespace string Name string Value Ent Trace []Stack }
func (EventLogStorageEvent[Ent, ID]) GetTrace ¶ added in v0.63.0
func (e EventLogStorageEvent[Ent, ID]) GetTrace() []Stack
func (EventLogStorageEvent[Ent, ID]) SetTrace ¶ added in v0.63.0
func (e EventLogStorageEvent[Ent, ID]) SetTrace(trace []Stack)
func (EventLogStorageEvent[Ent, ID]) String ¶ added in v0.63.0
func (e EventLogStorageEvent[Ent, ID]) String() string
type EventLogSubscriber ¶ added in v0.63.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.63.0
type EventLogTx struct {
// contains filtered or unexported fields
}
func (*EventLogTx) Append ¶ added in v0.63.0
func (tx *EventLogTx) Append(ctx context.Context, event Event) error
func (*EventLogTx) Events ¶ added in v0.63.0
func (tx *EventLogTx) Events() []Event
type EventManager ¶ added in v0.63.0
type EventManager interface { Append(context.Context, Event) error EventViewer }
type EventViewer ¶ added in v0.63.0
type EventViewer interface {
Events() []Event
}
type Memory ¶ added in v0.63.0
type Memory struct {
// contains filtered or unexported fields
}
func (*Memory) LookupMeta ¶ added in v0.63.0
type MemoryNamespace ¶ added in v0.63.0
type MemoryNamespace map[string]interface{}
type Storage ¶
type Storage[Ent, ID any] struct { Memory *Memory NewID func(context.Context) (ID, error) Namespace string // contains filtered or unexported fields }
func NewStorage ¶
func NewStorageWithNamespace ¶ added in v0.63.0
func (*Storage[Ent, ID]) DeleteByID ¶
func (*Storage[Ent, ID]) GetNamespace ¶ added in v0.63.0
func (*Storage[Ent, ID]) IDToMemoryKey ¶ added in v0.63.0
type StorageView ¶ added in v0.63.0
func (StorageView[Ent, ID]) FindByID ¶ added in v0.63.0
func (v StorageView[Ent, ID]) FindByID(id ID) (Ent, bool)
type Subscription ¶ added in v0.63.0
type Subscription struct {
// contains filtered or unexported fields
}
func (*Subscription) Close ¶ added in v0.63.0
func (s *Subscription) Close() (rErr error)
Click to show internal directories.
Click to hide internal directories.