shared

package
v1.2.10 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEventMessage

func NewEventMessage(aggregateID string, event interface{}, version *int, orderingKey string) ycq.EventMessage

func NewPubsubEventBus

func NewPubsubEventBus(projectID, topic string) ycq.EventBus

Types

type AggregateDefinition

type AggregateDefinition struct {
	Constructor func(id string) ycq.AggregateRoot
	Type        reflect.Type
}

type BaseGenericUnitOfWork

type BaseGenericUnitOfWork struct {
	Repos map[string]Repository
	sync.Mutex
}

func NewBaseGenericUnitOfWork

func NewBaseGenericUnitOfWork() *BaseGenericUnitOfWork

func (*BaseGenericUnitOfWork) AcceptAllChanges

func (uow *BaseGenericUnitOfWork) AcceptAllChanges()

func (*BaseGenericUnitOfWork) CommitAllChanges

func (uow *BaseGenericUnitOfWork) CommitAllChanges(ctx context.Context, transaction interface{}) error

func (*BaseGenericUnitOfWork) GetAggregateRepo

func (uow *BaseGenericUnitOfWork) GetAggregateRepo(aggregateType reflect.Type) Repository

func (*BaseGenericUnitOfWork) Load

func (uow *BaseGenericUnitOfWork) Load(typ reflect.Type, aggregateID string) (ycq.AggregateRoot, error)

func (*BaseGenericUnitOfWork) Save

func (uow *BaseGenericUnitOfWork) Save(aggregate ycq.AggregateRoot, expectedVersion *int) error

type EventMessage

type EventMessage interface {
	ycq.EventMessage
	OrderingKey() string
}

type Filter

type Filter struct {
	Path  string
	Op    string
	Value interface{}
}

type GenericReadDB

type GenericReadDB interface {
	SaveItem(transaction interface{}, id string, item interface{}) error
	LoadAllItems() ([]interface{}, error)
	LoadItem(id string) (interface{}, error)
	DeleteItem(transaction interface{}, id string) error
	UpdateItem(transaction interface{}, id string, updates interface{}) error
	ListItems(filter []Filter, limit int) ([]interface{}, error)
}

type GenericUnitOfWork

type GenericUnitOfWork interface {
	GetAggregateRepo(aggregateType reflect.Type) Repository
	Load(typ reflect.Type, aggregateID string) (ycq.AggregateRoot, error)
	Save(aggregate ycq.AggregateRoot, expectedVersion *int) error
	CommitAllChanges(ctx context.Context, transaction interface{}) error
	AcceptAllChanges()
}

type ItemFactory added in v1.0.3

type ItemFactory func() interface{}

type Lease

type Lease interface {
	Lock() (bool, error)
	Release() (bool, error)
}

type LeasingService

type LeasingService interface {
	GetLease(resourceID string, duration time.Duration) (Lease, error)
}

type Repository

type Repository interface {
	Load(id string) (ycq.AggregateRoot, error)
	Save(aggregate ycq.AggregateRoot, expectedVersion *int) error
	CommitChanges(ctx context.Context, transaction interface{}) error
	AcceptChanges()
}

Jump to

Keyboard shortcuts

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