Documentation ¶
Index ¶
- Constants
- type IDGenerator
- type MemoryEvent
- type MemoryEventManager
- type MemoryEventViewer
- type MemoryTableView
- type MemoryTransaction
- type MemoryView
- type Storage
- func (s *Storage) AddEvent(event MemoryEvent)
- func (s *Storage) BeginTx(ctx context.Context) (context.Context, error)
- func (s *Storage) CommitTx(ctx context.Context) error
- 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) EntityTypeNameFor(T interface{}) string
- func (s *Storage) Events() []MemoryEvent
- func (s *Storage) FindAll(ctx context.Context) iterators.Interface
- func (s *Storage) FindByID(ctx context.Context, ptr interface{}, id interface{}) (_found bool, _err error)
- func (s *Storage) IDGenerator() *IDGenerator
- func (s *Storage) InTx(ctx context.Context, fn func(tx *MemoryTransaction) error) error
- func (s *Storage) LogContextHistory(l logger, ctx context.Context)
- func (s *Storage) LogHistory(l logger)
- func (s *Storage) LookupTx(ctx context.Context) (*MemoryTransaction, bool)
- func (s *Storage) RollbackTx(ctx context.Context) error
- func (s *Storage) SubscribeToCreate(ctx context.Context, subscriber frameless.Subscriber) (frameless.Subscription, error)
- func (s *Storage) SubscribeToDeleteAll(ctx context.Context, subscriber frameless.Subscriber) (frameless.Subscription, error)
- func (s *Storage) SubscribeToDeleteByID(ctx context.Context, subscriber frameless.Subscriber) (frameless.Subscription, error)
- func (s *Storage) SubscribeToUpdate(ctx context.Context, subscriber frameless.Subscriber) (frameless.Subscription, error)
- func (s *Storage) Update(ctx context.Context, ptr interface{}) error
- type TraceElem
Examples ¶
Constants ¶
View Source
const ( BeginTxEvent = `BeginTx` CommitTxEvent = `CommitTx` RollbackTxEvent = `RollbackTx` CreateEvent = `Create` UpdateEvent = `Update` DeleteAllEvent = `DeleteAll` DeleteByIDEvent = `DeleteByID` )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IDGenerator ¶
type MemoryEvent ¶
type MemoryEventManager ¶
type MemoryEventManager interface { AddEvent(MemoryEvent) MemoryEventViewer }
type MemoryEventViewer ¶
type MemoryEventViewer interface {
Events() []MemoryEvent
}
type MemoryTableView ¶
type MemoryTableView map[string]interface{} // id => entity <T>
func (MemoryTableView) FindByID ¶
func (v MemoryTableView) FindByID(id interface{}) interface{}
type MemoryTransaction ¶
type MemoryTransaction struct {
// contains filtered or unexported fields
}
func (*MemoryTransaction) AddEvent ¶
func (tx *MemoryTransaction) AddEvent(event MemoryEvent)
func (*MemoryTransaction) Events ¶
func (tx *MemoryTransaction) Events() []MemoryEvent
func (*MemoryTransaction) View ¶
func (tx *MemoryTransaction) View() MemoryView
func (*MemoryTransaction) ViewFor ¶
func (tx *MemoryTransaction) ViewFor(T interface{}) MemoryTableView
type MemoryView ¶
type MemoryView map[string]MemoryTableView // entity type name => table view
type Storage ¶
type Storage struct { T interface{} Options struct { DisableEventLogging bool DisableAsyncSubscriptionHandling bool DisableRelativePathResolvingForTrace bool } // contains filtered or unexported fields }
Storage is an event source principles based development in memory storage, that allows easy debugging and tracing during development for fast and descriptive feedback loops.
Example ¶
inmemory2.NewStorage(Entity{})
Output:
func NewStorage ¶
func NewStorage(T interface{}) *Storage
func (*Storage) AddEvent ¶
func (s *Storage) AddEvent(event MemoryEvent)
func (*Storage) DeleteByID ¶
func (*Storage) EntityTypeNameFor ¶
func (*Storage) Events ¶
func (s *Storage) Events() []MemoryEvent
func (*Storage) IDGenerator ¶
func (s *Storage) IDGenerator() *IDGenerator
func (*Storage) LogContextHistory ¶
func (*Storage) LogHistory ¶
func (s *Storage) LogHistory(l logger)
func (*Storage) LookupTx ¶
func (s *Storage) LookupTx(ctx context.Context) (*MemoryTransaction, bool)
func (*Storage) SubscribeToCreate ¶
func (s *Storage) SubscribeToCreate(ctx context.Context, subscriber frameless.Subscriber) (frameless.Subscription, error)
func (*Storage) SubscribeToDeleteAll ¶
func (s *Storage) SubscribeToDeleteAll(ctx context.Context, subscriber frameless.Subscriber) (frameless.Subscription, error)
func (*Storage) SubscribeToDeleteByID ¶
func (s *Storage) SubscribeToDeleteByID(ctx context.Context, subscriber frameless.Subscriber) (frameless.Subscription, error)
func (*Storage) SubscribeToUpdate ¶
func (s *Storage) SubscribeToUpdate(ctx context.Context, subscriber frameless.Subscriber) (frameless.Subscription, error)
Click to show internal directories.
Click to hide internal directories.