partybus

package module
v0.0.0-...-8ccac15 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 3 Imported by: 47 modules, 194 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

partybus

An event bus in go.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsubscribe = fmt.Errorf("unable to find subscription to unsubscribe")

Functions

func Join

func Join(cs ...<-chan Event) <-chan Event

Types

type Bus

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

func NewBus

func NewBus() *Bus

func (*Bus) Close

func (bus *Bus) Close()

func (*Bus) Publish

func (bus *Bus) Publish(event Event)

func (*Bus) Subscribe

func (bus *Bus) Subscribe(eTypes ...EventType) *Subscription

func (*Bus) Unsubscribe

func (bus *Bus) Unsubscribe(sub *Subscription) error

type Event

type Event struct {
	Type   EventType
	Source interface{}
	Value  interface{}
	Error  error
}

type EventType

type EventType string

type Handler

type Handler interface {
	Handle(Event) error
}

type Publisher

type Publisher interface {
	Publish(Event)
}

type Responder

type Responder interface {
	RespondsTo() []EventType
}

type Subscriber

type Subscriber interface {
	Subscribe(...EventType) *Subscription
}

type Subscription

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

func (*Subscription) Events

func (s *Subscription) Events() <-chan Event

func (*Subscription) Unsubscribe

func (s *Subscription) Unsubscribe() error

type SubscriptionId

type SubscriptionId int64

type Unsubscribable

type Unsubscribable interface {
	Unsubscribe() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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