fixtures

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package fixtures is a set of test fixtures and mocks for BoltDB projections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageHandler

type MessageHandler struct {
	ConfigureFunc   func(c dogma.ProjectionConfigurer)
	HandleEventFunc func(context.Context, *bolt.Tx, dogma.ProjectionEventScope, dogma.Message) error
	TimeoutHintFunc func(m dogma.Message) time.Duration
	CompactFunc     func(context.Context, *bolt.DB, dogma.ProjectionCompactScope) error
}

MessageHandler is a test implementation of boltdb.MessageHandler.

func (*MessageHandler) Compact added in v0.5.0

Compact reduces the size of the projection's data.

If h.CompactFunc is non-nil it returns h.CompactFunc(ctx,db,s), otherwise it returns nil.

func (*MessageHandler) Configure

func (h *MessageHandler) Configure(c dogma.ProjectionConfigurer)

Configure configures the behavior of the engine as it relates to this handler.

c provides access to the various configuration options, such as specifying which types of event messages are routed to this handler.

If h.ConfigureFunc is non-nil, it calls h.ConfigureFunc(c).

func (*MessageHandler) HandleEvent

func (h *MessageHandler) HandleEvent(
	ctx context.Context,
	tx *bolt.Tx,
	s dogma.ProjectionEventScope,
	m dogma.Message,
) error

HandleEvent handles a domain event message that has been routed to this handler.

If h.HandleEventFunc is non-nil it returns h.HandleEventFunc(ctx, tx, s, m).

func (*MessageHandler) TimeoutHint

func (h *MessageHandler) TimeoutHint(m dogma.Message) time.Duration

TimeoutHint returns a duration that is suitable for computing a deadline for the handling of the given message by this handler.

If h.TimeoutHintFunc is non-nil it returns h.TimeoutHintFunc(m), otherwise it returns 0.

Jump to

Keyboard shortcuts

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