mediator

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 23, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Behaviour

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

type Builder

type Builder interface {
	RegisterHandler(request Message, handler RequestHandler) Builder
	UseBehaviour(PipelineBehaviour) Builder
	Use(fn func(context.Context, Message, Next) (interface{}, error)) Builder
	Build() (*Mediator, error)
}

type Mediator

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

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 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
}

func NewContext

func NewContext() *PipelineContext

func (*PipelineContext) Build

func (p *PipelineContext) Build() (*Mediator, error)

func (*PipelineContext) RegisterHandler

func (p *PipelineContext) RegisterHandler(req Message, h RequestHandler) Builder

func (*PipelineContext) Use

func (p *PipelineContext) Use(call func(context.Context, Message, Next) (interface{}, error)) Builder

func (*PipelineContext) UseBehaviour

func (p *PipelineContext) UseBehaviour(behaviour PipelineBehaviour) Builder

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