testing

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

TODO: make subscription publishing related to tx commit instead to be done on the fly

Index

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

func (History) LogWith

func (h History) LogWith(l interface{ Log(args ...interface{}) })

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) BeginTx

func (s *Storage) BeginTx(ctx context.Context) (context.Context, error)

func (*Storage) CommitTx

func (s *Storage) CommitTx(ctx context.Context) error

func (*Storage) Create

func (s *Storage) Create(ctx context.Context, ptr interface{}) error

func (*Storage) DeleteAll

func (s *Storage) DeleteAll(ctx context.Context, T interface{}) error

func (*Storage) DeleteByID

func (s *Storage) DeleteByID(ctx context.Context, T interface{}, id string) error

func (*Storage) EntityTypeNameFor

func (s *Storage) EntityTypeNameFor(T interface{}) string

func (*Storage) Events

func (s *Storage) Events() []StorageEvent

func (*Storage) FindAll

func (s *Storage) FindAll(ctx context.Context, T interface{}) frameless.Iterator

func (*Storage) FindByID

func (s *Storage) FindByID(ctx context.Context, ptr interface{}, id string) (_found bool, _err error)

func (*Storage) History

func (s *Storage) History() History

func (*Storage) InTx

func (s *Storage) InTx(ctx context.Context, fn func(tx *StorageTransaction) error) error

func (*Storage) RollbackTx

func (s *Storage) RollbackTx(ctx context.Context) error

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)

func (*Storage) Update

func (s *Storage) Update(ctx context.Context, ptr interface{}) error

type StorageEvent

type StorageEvent struct {
	T              interface{}
	EntityTypeName string
	Event          string
	ID             string
	Entity         interface{}
	Trace          []string
}

type StorageEventManager

type StorageEventManager interface {
	AddEvent(StorageEvent)
	StorageEventViewer
}

type StorageEventView

type StorageEventView map[string]map[string]interface{} // T => id => entity

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL