setup

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, options ...Option) (cqrs.Container, error)

New ...

func NewWithConfigs

func NewWithConfigs(
	ctx context.Context,
	aggregateConfig cqrs.AggregateConfig,
	eventConfig cqrs.EventConfig,
	commandConfig cqrs.CommandConfig,
	options ...Option,
) (cqrs.Container, error)

NewWithConfigs ...

Types

type AggregateRepositoryFactory

type AggregateRepositoryFactory func(context.Context, Setup) (cqrs.AggregateRepository, error)

AggregateRepositoryFactory ...

type CommandBusFactory

type CommandBusFactory func(context.Context, Setup) (cqrs.CommandBus, error)

CommandBusFactory ...

type CommandHandlerFactory

type CommandHandlerFactory func(context.Context, Setup) (cqrs.CommandHandler, []cqrs.CommandType, error)

CommandHandlerFactory ...

type EventBusFactory

type EventBusFactory func(context.Context, Setup) (cqrs.EventBus, error)

EventBusFactory ...

type EventStoreFactory

type EventStoreFactory func(context.Context, Setup) (cqrs.EventStore, error)

EventStoreFactory ...

type Option

type Option func(Setup)

Option ...

func WithAggregate

func WithAggregate(typ cqrs.AggregateType, factory cqrs.AggregateFactory) Option

WithAggregate ...

func WithAggregateRepositoryFactory

func WithAggregateRepositoryFactory(f AggregateRepositoryFactory) Option

WithAggregateRepositoryFactory ...

func WithCommand

func WithCommand(typ cqrs.CommandType, handler cqrs.CommandHandler) Option

WithCommand ...

func WithCommandBusFactory

func WithCommandBusFactory(f CommandBusFactory) Option

WithCommandBusFactory ...

func WithCommandHandlerFactory

func WithCommandHandlerFactory(factories ...CommandHandlerFactory) Option

WithCommandHandlerFactory ...

func WithEvent

func WithEvent(typ cqrs.EventType, proto cqrs.EventData) Option

WithEvent ...

func WithEventBusFactory

func WithEventBusFactory(f EventBusFactory) Option

WithEventBusFactory ...

func WithEventStoreFactory

func WithEventStoreFactory(f EventStoreFactory) Option

WithEventStoreFactory ...

func WithLogger

func WithLogger(logger *log.Logger) Option

WithLogger ...

func WithSnapshotRepositoryFactory

func WithSnapshotRepositoryFactory(f SnapshotRepositoryFactory) Option

WithSnapshotRepositoryFactory ...

type Setup

type Setup interface {
	SetLogger(*log.Logger)

	AggregateConfig() cqrs.AggregateConfig
	EventConfig() cqrs.EventConfig
	CommandConfig() cqrs.CommandConfig

	SetEventStoreFactory(EventStoreFactory)
	SetEventBusFactory(EventBusFactory)
	SetCommandBusFactory(CommandBusFactory)
	AddCommandHandlerFactory(...CommandHandlerFactory)
	SetSnapshotRepositoryFactory(SnapshotRepositoryFactory)
	SetAggregateRepositoryFactory(AggregateRepositoryFactory)

	EventStore() cqrs.EventStore
	EventBus() cqrs.EventBus
	CommandBus() cqrs.CommandBus
	SnapshotRepository() cqrs.SnapshotRepository
	AggregateRepository() cqrs.AggregateRepository

	RegisterAggregate(cqrs.AggregateType, cqrs.AggregateFactory)
	RegisterEvent(cqrs.EventType, cqrs.EventData)
	RegisterCommand(cqrs.CommandType, cqrs.CommandHandler)
}

Setup ...

type SnapshotRepositoryFactory

type SnapshotRepositoryFactory func(context.Context, Setup) (cqrs.SnapshotRepository, error)

SnapshotRepositoryFactory ...

Jump to

Keyboard shortcuts

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