event

package
v1.14.8 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 0 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arg

type Arg struct {
	Type  string
	Value any
}

type Event

type Event interface {
	// Handle the event.
	Handle(args []Arg) ([]Arg, error)
}

type Instance

type Instance interface {
	// Register event listeners to the application.
	Register(map[Event][]Listener)
	// Job create a new event task.
	Job(event Event, args []Arg) Task
	// GetEvents gets all registered events.
	GetEvents() map[Event][]Listener
}

type Listener

type Listener interface {
	// Signature returns the unique identifier for the listener.
	Signature() string
	// Queue configure the event queue options.
	Queue(args ...any) Queue
	// Handle the event.
	Handle(args ...any) error
}

type Queue

type Queue struct {
	Enable     bool
	Connection string
	Queue      string
}

type Task

type Task interface {
	// Dispatch an event and call the listeners.
	Dispatch() error
}

Jump to

Keyboard shortcuts

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