xevent

package
v0.0.0-...-44f2542 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register[Event any](registry Registry, name string, factory func() Event)

Register registers a payload factory function for the given event type.

Types

type DefaultPayloadFactoryRegistry

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

DefaultPayloadFactoryRegistry is the default implementation of PayloadFactoryRegistry.

func NewPayloadRegistry

func NewPayloadRegistry() *DefaultPayloadFactoryRegistry

NewPayloadRegistry creates a new instance of DefaultPayloadFactoryRegistry.

func (*DefaultPayloadFactoryRegistry) GetFactory

func (r *DefaultPayloadFactoryRegistry) GetFactory(eventType string) (func() interface{}, error)

GetFactory retrieves the payload factory function for the given event type.

func (*DefaultPayloadFactoryRegistry) Register

func (r *DefaultPayloadFactoryRegistry) Register(eventType string, factory func() interface{})

Register adds a payload factory function for the given event type.

type Registry

type Registry interface {
	Register(eventType string, factory func() interface{})
	GetFactory(eventType string) (func() interface{}, error)
}

Registry defines the interface for registering and retrieving payload factories.

Jump to

Keyboard shortcuts

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