observer

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 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 Event

type Event[T comparable] struct {
	Topic   T
	Payload protoreflect.ProtoMessage
}

type Observer

type Observer[T comparable] struct {
	// contains filtered or unexported fields
}

func NewObserver

func NewObserver[T comparable]() *Observer[T]

NewObserver ...

func (*Observer[T]) Emit

func (o *Observer[T]) Emit(e *Event[T]) error

Emit ...

func (*Observer[T]) Subscribe

func (o *Observer[T]) Subscribe(t T, p Processor[T]) SourceID

Subscribe ...

func (*Observer[T]) Unsubscribe

func (o *Observer[T]) Unsubscribe(s SourceID)

Unsubscribe ...

type Processor

type Processor[T comparable] func(e *Event[T]) error

type SourceID

type SourceID int64

Jump to

Keyboard shortcuts

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