mediator

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
	Kind() EventKind
}

Event 事件接口

type EventCollection

type EventCollection interface {
	Add(Event)
	Raise(Mediator)
}

func NewEventCollection

func NewEventCollection() EventCollection

type EventHandler

type EventHandler interface {
	Listening() []EventKind
	Handle(context.Context, Event)
}

type EventKind

type EventKind string

EventKind 事件类型描述

type Mediator

type Mediator interface {
	Dispatch(Event)
	Subscribe(EventHandler)
}

func NewInMemMediator

func NewInMemMediator(concurrent int, opts ...Option) Mediator

type Option added in v0.1.1

type Option func(*inMemMediator)

func WithOrphanEventHandler added in v0.1.1

func WithOrphanEventHandler(fn func(Event)) Option

Jump to

Keyboard shortcuts

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