mediator

package
v0.0.0-...-746952f Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHandlerNotFound = errors.New("handler could not be found")
	ErrInvalidArg      = errors.New("invalid arg")
)

Functions

This section is empty.

Types

type Behavior

type Behavior func(context.Context, Message, Next) (interface{}, error)

type Behaviors

type Behaviors []Behavior

type Mediator

type Mediator struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) (*Mediator, error)

func (*Mediator) Send

func (m *Mediator) Send(ctx context.Context, req Message) (interface{}, error)

type Message

type Message interface {
	Key() string
}

type Next

type Next func(ctx context.Context) (interface{}, error)

type Option

type Option func(pCtx *PipelineContext) error

func WithBehaviour

func WithBehaviour(behavior PipelineBehaviour) Option

func WithBehaviourFunc

func WithBehaviourFunc(fn func(context.Context, Message, Next) (interface{}, error)) Option

func WithHandler

func WithHandler(req Message, rh RequestHandler) Option

type Pipeline

type Pipeline func(context.Context, Message) (interface{}, error)

type PipelineBehaviour

type PipelineBehaviour interface {
	Process(context.Context, Message, Next) (interface{}, error)
}

type PipelineContext

type PipelineContext struct {
	// contains filtered or unexported fields
}

type RequestHandler

type RequestHandler interface {
	Handle(context.Context, Message) (interface{}, error)
}

type Sender

type Sender interface {
	Send(context.Context, Message) (interface{}, error)
}

Jump to

Keyboard shortcuts

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