Documentation ¶
Index ¶
- Variables
- type AggregateReducer
- type Check
- type Column
- type Condition
- type EventReducer
- type Executer
- type Handler
- type HandlerConfig
- type Init
- type Lock
- type ProjectionHandler
- func (h *ProjectionHandler) FetchEvents(ctx context.Context, instances ...string) ([]eventstore.Event, bool, error)
- func (h *ProjectionHandler) Process(ctx context.Context, events ...eventstore.Event) (index int, err error)
- func (h *ProjectionHandler) Trigger(ctx context.Context, instances ...string) error
- type ProjectionHandlerConfig
- type Reduce
- type SearchQuery
- type Statement
- type Statements
- type Unlock
- type Update
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AggregateReducer ¶
type AggregateReducer struct { Aggregate eventstore.AggregateType EventRedusers []EventReducer }
EventReducer represents the required data to work with aggregates
type Column ¶
func NewJSONCol ¶
type EventReducer ¶
type EventReducer struct { Event eventstore.EventType Reduce Reduce }
EventReducer represents the required data to work with events
type Handler ¶
type Handler struct { Eventstore *eventstore.Eventstore Sub *eventstore.Subscription EventQueue chan eventstore.Event }
func NewHandler ¶
func NewHandler(config HandlerConfig) Handler
func (*Handler) Subscribe ¶
func (h *Handler) Subscribe(aggregates ...eventstore.AggregateType)
func (*Handler) SubscribeEvents ¶
func (h *Handler) SubscribeEvents(types map[eventstore.AggregateType][]eventstore.EventType)
func (*Handler) Unsubscribe ¶
func (h *Handler) Unsubscribe()
type HandlerConfig ¶
type HandlerConfig struct {
Eventstore *eventstore.Eventstore
}
type ProjectionHandler ¶
type ProjectionHandler struct { Handler ProjectionName string // contains filtered or unexported fields }
func NewProjectionHandler ¶
func NewProjectionHandler( ctx context.Context, config ProjectionHandlerConfig, reduce Reduce, update Update, query SearchQuery, lock Lock, unlock Unlock, initialized <-chan bool, ) *ProjectionHandler
func (*ProjectionHandler) FetchEvents ¶
func (h *ProjectionHandler) FetchEvents(ctx context.Context, instances ...string) ([]eventstore.Event, bool, error)
FetchEvents checks the current sequences and filters for newer events
func (*ProjectionHandler) Process ¶
func (h *ProjectionHandler) Process(ctx context.Context, events ...eventstore.Event) (index int, err error)
Process handles multiple events by reducing them to statements and updating the projection
func (*ProjectionHandler) Trigger ¶
func (h *ProjectionHandler) Trigger(ctx context.Context, instances ...string) error
Trigger handles all events for the provided instances (or current instance from context if non specified) by calling FetchEvents and Process until the amount of events is smaller than the BulkLimit
type ProjectionHandlerConfig ¶
type Reduce ¶
type Reduce func(eventstore.Event) (*Statement, error)
Reduce reduces the given event to a statement which is used to update the projection
type SearchQuery ¶
type SearchQuery func(ctx context.Context, instanceIDs []string) (query *eventstore.SearchQueryBuilder, queryLimit uint64, err error)
SearchQuery generates the search query to lookup for events
type Statement ¶
type Statement struct { AggregateType eventstore.AggregateType Sequence uint64 PreviousSequence uint64 InstanceID string Execute func(ex Executer, projectionName string) error }
type Statements ¶
type Statements []Statement
func (Statements) Len ¶
func (stmts Statements) Len() int
func (Statements) Less ¶
func (stmts Statements) Less(i, j int) bool
func (Statements) Swap ¶
func (stmts Statements) Swap(i, j int)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.