event

package
v0.0.0-...-d389d3b Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Created = iota
	Updated
	Deleted
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

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

func NewDispatcher

func NewDispatcher() *Dispatcher

func (*Dispatcher) Dispatch

func (d *Dispatcher) Dispatch(ctx context.Context, event Event)

func (*Dispatcher) Register

func (d *Dispatcher) Register(listener Listener, names ...Name) error

type EntityConverter

type EntityConverter[T any] func(entity T) any

type EntityEvent

type EntityEvent struct {
	Time   time.Time
	Entity any
	Action EventAction
}

func (EntityEvent) Name

func (c EntityEvent) Name() Name

type EntityEventListener

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

func NewEntityEventListener

func NewEntityEventListener(publisher pubsub.AMQPPublisher) *EntityEventListener

func (EntityEventListener) Listen

func (u EntityEventListener) Listen(ctx context.Context, event Event)

type Event

type Event interface {
	Name() Name
}

type EventAction

type EventAction int

func (EventAction) String

func (e EventAction) String() string

type Listener

type Listener interface {
	Listen(ctx context.Context, event Event)
}

type Name

type Name string
const EntityEventName Name = "entity"

Jump to

Keyboard shortcuts

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