Documentation ¶
Index ¶
- Variables
- func RestoreFromEvent(s *Stream, event *event.Event)
- type CommandController
- type CommandControllerOption
- type CommandSinker
- type CommandSinkerInterceptor
- type ConnectorPublisher
- type ControllerFunc
- type EventController
- type EventControllerOption
- type EventErrorHandler
- type EventHandler
- type EventHandlerFunc
- type EventHandlerInterceptor
- type EventSinker
- type EventSinkerInterceptor
- type Mutator
- func (m *Mutator) AddCommandController(commandName string, ctrl CommandController, opts ...CommandControllerOption)
- func (m *Mutator) AddEventController(eventName string, ctrl EventController, opts ...EventControllerOption)
- func (m *Mutator) CommandSink(ctx context.Context, cmd *command.Command) (*command.Reply, error)
- func (m *Mutator) EventSink(ctx context.Context, e *event.Event) (err error)
- func (m *Mutator) SetBlacklistOfEvents(eventNames ...string)
- type MutatorOption
- type Picker
- type Projection
- func (p *Projection) AddEventController(eventName string, fn EventHandlerFunc)
- func (p *Projection) AddEventControllerWithRollback(eventName string, fn, rollback EventHandlerFunc)
- func (p *Projection) Handle(ctx context.Context, e *event.Event) error
- func (p *Projection) Match(eventName string) bool
- func (p *Projection) Rollback(ctx context.Context, e *event.Event) error
- func (p *Projection) SkipUnhandledEvent()
- type Publisher
- type State
- type Storage
- type Stream
- func (s *Stream) Changes() []*event.Event
- func (s *Stream) ClearChanges()
- func (s *Stream) ID() uuid.UUID
- func (s *Stream) MarshalBinary() (data []byte, err error)
- func (s *Stream) Mutate(eventName string, payload codec.Codec)
- func (s *Stream) Name() string
- func (s *Stream) PreviousVersion() int
- func (s *Stream) State() State
- func (s *Stream) String() string
- func (s *Stream) Unix() int64
- func (s *Stream) UnmarshalBinary(data []byte) error
- func (s *Stream) Version() int
- type Subscriber
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidInputData = errors.New("stream: unmarshal error: invalid data input")
Functions ¶
func RestoreFromEvent ¶
Types ¶
type CommandController ¶
type CommandControllerOption ¶
type CommandControllerOption func(*commandController)
func WithCommandControllerCreateIfNotExists ¶
func WithCommandControllerCreateIfNotExists() CommandControllerOption
func WithCommandControllerDropStream ¶
func WithCommandControllerDropStream() CommandControllerOption
type CommandSinker ¶
type CommandSinker interface {
CommandSink(ctx context.Context, cmd *command.Command) (*command.Reply, error)
}
func WithCommandSinkerInterceptor ¶
func WithCommandSinkerInterceptor(s CommandSinker, other ...CommandSinkerInterceptor) CommandSinker
type CommandSinkerInterceptor ¶
type CommandSinkerInterceptor func(CommandSinker) CommandSinker
type ConnectorPublisher ¶
type ConnectorPublisher struct { }
type ControllerFunc ¶
type EventController ¶
type EventControllerOption ¶
type EventControllerOption func(*eventController)
func WithEventControllerCreateIfNotExists ¶
func WithEventControllerCreateIfNotExists() EventControllerOption
func WithEventControllerDropStream ¶
func WithEventControllerDropStream() EventControllerOption
type EventErrorHandler ¶
type EventHandler ¶
type EventHandler interface { Match(eventName string) bool Handle(context.Context, *event.Event) error Rollback(context.Context, *event.Event) error }
func WithEventHandlerInterceptor ¶
func WithEventHandlerInterceptor(eh EventHandler, other ...EventHandlerInterceptor) EventHandler
type EventHandlerInterceptor ¶
type EventHandlerInterceptor func(handler EventHandler) EventHandler
type EventSinker ¶
func WithEventSinkerInterceptor ¶
func WithEventSinkerInterceptor(s EventSinker, other ...EventSinkerInterceptor) EventSinker
type EventSinkerInterceptor ¶
type EventSinkerInterceptor func(EventSinker) EventSinker
type Mutator ¶
type Mutator struct {
// contains filtered or unexported fields
}
func NewMutator ¶
func NewMutator( storage Storage, publisher Publisher, opts ...MutatorOption, ) *Mutator
func (*Mutator) AddCommandController ¶
func (m *Mutator) AddCommandController( commandName string, ctrl CommandController, opts ...CommandControllerOption, )
func (*Mutator) AddEventController ¶
func (m *Mutator) AddEventController( eventName string, ctrl EventController, opts ...EventControllerOption, )
func (*Mutator) CommandSink ¶
func (*Mutator) SetBlacklistOfEvents ¶
type MutatorOption ¶
type MutatorOption func(*Mutator)
func WithMutatorStrictMode ¶
func WithMutatorStrictMode() MutatorOption
type Projection ¶
type Projection struct {
// contains filtered or unexported fields
}
func NewProjection ¶
func NewProjection() *Projection
func (*Projection) AddEventController ¶
func (p *Projection) AddEventController(eventName string, fn EventHandlerFunc)
func (*Projection) AddEventControllerWithRollback ¶
func (p *Projection) AddEventControllerWithRollback(eventName string, fn, rollback EventHandlerFunc)
func (*Projection) Match ¶
func (p *Projection) Match(eventName string) bool
func (*Projection) SkipUnhandledEvent ¶
func (p *Projection) SkipUnhandledEvent()
type Publisher ¶
func NewConnectorPublisher ¶
func NewConnectorPublisher() Publisher
type State ¶
type State interface { Mutate(*event.Event) encoding.BinaryUnmarshaler encoding.BinaryMarshaler }
type Storage ¶
type Storage interface { StreamName() string NewStream() *Stream Persist(ctx context.Context, s *Stream) error Load(ctx context.Context, streamID uuid.UUID) (*Stream, error) Drop(ctx context.Context, streamID uuid.UUID) error }
func NewStorage ¶
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
func (*Stream) ClearChanges ¶
func (s *Stream) ClearChanges()
func (*Stream) MarshalBinary ¶
func (*Stream) PreviousVersion ¶
func (*Stream) UnmarshalBinary ¶
type Subscriber ¶
type Subscriber interface {
Subscribe(streamName string, h ...EventHandler)
}
Click to show internal directories.
Click to hide internal directories.