Documentation ¶
Overview ¶
TODO: make subscription publishing related to tx commit instead to be done on the fly
Index ¶
- type History
- type Storage
- func (s *Storage) AddEvent(event StorageEvent)
- 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, T interface{}) error
- func (s *Storage) DeleteByID(ctx context.Context, T interface{}, id string) error
- func (s *Storage) EntityTypeNameFor(T interface{}) string
- func (s *Storage) Events() []StorageEvent
- func (s *Storage) FindAll(ctx context.Context, T interface{}) frameless.Iterator
- func (s *Storage) FindByID(ctx context.Context, ptr interface{}, id string) (_found bool, _err error)
- func (s *Storage) History() History
- func (s *Storage) InTx(ctx context.Context, fn func(tx *StorageTransaction) error) error
- func (s *Storage) RollbackTx(ctx context.Context) error
- func (s *Storage) SubscribeToCreate(T interface{}, subscriber resources.Subscriber) (resources.Subscription, error)
- func (s *Storage) SubscribeToDeleteAll(T interface{}, subscriber resources.Subscriber) (resources.Subscription, error)
- func (s *Storage) SubscribeToDeleteByID(T interface{}, subscriber resources.Subscriber) (resources.Subscription, error)
- func (s *Storage) SubscribeToUpdate(T interface{}, subscriber resources.Subscriber) (resources.Subscription, error)
- func (s *Storage) Update(ctx context.Context, ptr interface{}) error
- type StorageEvent
- type StorageEventManager
- type StorageEventView
- type StorageEventViewer
- type StorageTransaction
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type History ¶
type History struct {
// contains filtered or unexported fields
}
History will return a list of the event history of the
type Storage ¶
type Storage struct {
// 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 ¶
package main import ( "github.com/adamluzsi/frameless/testing" ) func main() { testing.NewStorage() }
Output:
func NewStorage ¶
func NewStorage() *Storage
func (*Storage) AddEvent ¶
func (s *Storage) AddEvent(event StorageEvent)
func (*Storage) DeleteByID ¶
func (*Storage) EntityTypeNameFor ¶
func (*Storage) Events ¶
func (s *Storage) Events() []StorageEvent
func (*Storage) SubscribeToCreate ¶
func (s *Storage) SubscribeToCreate(T interface{}, subscriber resources.Subscriber) (resources.Subscription, error)
func (*Storage) SubscribeToDeleteAll ¶
func (s *Storage) SubscribeToDeleteAll(T interface{}, subscriber resources.Subscriber) (resources.Subscription, error)
func (*Storage) SubscribeToDeleteByID ¶
func (s *Storage) SubscribeToDeleteByID(T interface{}, subscriber resources.Subscriber) (resources.Subscription, error)
func (*Storage) SubscribeToUpdate ¶
func (s *Storage) SubscribeToUpdate(T interface{}, subscriber resources.Subscriber) (resources.Subscription, error)
type StorageEvent ¶
type StorageEventManager ¶
type StorageEventManager interface { AddEvent(StorageEvent) StorageEventViewer }
type StorageEventView ¶
func StorageEventViewFor ¶
func StorageEventViewFor(eh StorageEventViewer) StorageEventView
type StorageEventViewer ¶
type StorageEventViewer interface {
Events() []StorageEvent
}
type StorageTransaction ¶
type StorageTransaction struct {
// contains filtered or unexported fields
}
func (*StorageTransaction) AddEvent ¶
func (tx *StorageTransaction) AddEvent(event StorageEvent)
func (StorageTransaction) Events ¶
func (tx StorageTransaction) Events() []StorageEvent
func (StorageTransaction) View ¶
func (tx StorageTransaction) View() StorageEventView
Click to show internal directories.
Click to hide internal directories.