storages

package
v0.23.5 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

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

Index

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 added in v0.23.0

type IDGenerator map[string]func() (interface{}, error)

func (*IDGenerator) Register added in v0.23.0

func (g *IDGenerator) Register(T resources.T, genFunc func() (interface{}, error))

type Memory added in v0.11.0

type Memory struct {
	Options struct {
		DisableEventLogging                  bool
		DisableAsyncSubscriptionHandling     bool
		DisableRelativePathResolvingForTrace bool
	}
	// contains filtered or unexported fields
}

Memory is an event source principles based development in memory storage, that allows easy debugging and tracing during development for fast and descriptive feedback loops.

func NewMemory added in v0.11.0

func NewMemory() *Memory

func (*Memory) AddEvent added in v0.11.0

func (s *Memory) AddEvent(event MemoryEvent)

func (*Memory) BeginTx added in v0.11.0

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

func (*Memory) CommitTx added in v0.11.0

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

func (*Memory) Create added in v0.11.0

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

func (*Memory) DeleteAll added in v0.11.0

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

func (*Memory) DeleteByID added in v0.11.0

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

func (*Memory) EntityTypeNameFor added in v0.11.0

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

func (*Memory) Events added in v0.11.0

func (s *Memory) Events() []MemoryEvent

func (*Memory) FindAll added in v0.11.0

func (s *Memory) FindAll(ctx context.Context, T interface{}) iterators.Interface

func (*Memory) FindByID added in v0.11.0

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

func (*Memory) IDGenerator added in v0.23.0

func (s *Memory) IDGenerator() *IDGenerator

func (*Memory) InTx added in v0.11.0

func (s *Memory) InTx(ctx context.Context, fn func(tx *MemoryTransaction) error) error

func (*Memory) LogContextHistory added in v0.16.0

func (s *Memory) LogContextHistory(l logger, ctx context.Context)

func (*Memory) LogHistory added in v0.16.0

func (s *Memory) LogHistory(l logger)

func (*Memory) LookupTx added in v0.17.0

func (s *Memory) LookupTx(ctx context.Context) (*MemoryTransaction, bool)

func (*Memory) RollbackTx added in v0.11.0

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

func (*Memory) SubscribeToCreate added in v0.11.0

func (s *Memory) SubscribeToCreate(ctx context.Context, T interface{}, subscriber resources.Subscriber) (resources.Subscription, error)

func (*Memory) SubscribeToDeleteAll added in v0.11.0

func (s *Memory) SubscribeToDeleteAll(ctx context.Context, T interface{}, subscriber resources.Subscriber) (resources.Subscription, error)

func (*Memory) SubscribeToDeleteByID added in v0.11.0

func (s *Memory) SubscribeToDeleteByID(ctx context.Context, T interface{}, subscriber resources.Subscriber) (resources.Subscription, error)

func (*Memory) SubscribeToUpdate added in v0.11.0

func (s *Memory) SubscribeToUpdate(ctx context.Context, T interface{}, subscriber resources.Subscriber) (resources.Subscription, error)

func (*Memory) Update added in v0.11.0

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

type MemoryEvent added in v0.11.0

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

type MemoryEventManager added in v0.11.0

type MemoryEventManager interface {
	AddEvent(MemoryEvent)
	MemoryEventViewer
}

type MemoryEventViewer added in v0.11.0

type MemoryEventViewer interface {
	Events() []MemoryEvent
}

type MemoryTableView added in v0.11.1

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

func (MemoryTableView) FindByID added in v0.22.0

func (v MemoryTableView) FindByID(id interface{}) interface{}

type MemoryTransaction added in v0.11.0

type MemoryTransaction struct {
	// contains filtered or unexported fields
}

func (*MemoryTransaction) AddEvent added in v0.11.0

func (tx *MemoryTransaction) AddEvent(event MemoryEvent)

func (*MemoryTransaction) Events added in v0.11.0

func (tx *MemoryTransaction) Events() []MemoryEvent

func (*MemoryTransaction) View added in v0.11.0

func (tx *MemoryTransaction) View() MemoryView

func (*MemoryTransaction) ViewFor added in v0.11.1

func (tx *MemoryTransaction) ViewFor(T interface{}) MemoryTableView

type MemoryView added in v0.11.1

type MemoryView map[string]MemoryTableView // entity type name => table view

type TraceElem added in v0.20.0

type TraceElem struct {
	Path string
	Line int
}

Jump to

Keyboard shortcuts

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