events

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionWithEvent

type ActionWithEvent[SESS context.Context] func(sess SESS, ev Event) error

type Event

type Event interface {
	// Returns the event's scope.
	Scope() string
	// Returns the event's key.
	Key() string
	// Returns the time at which the event was created using Create.
	Time() time.Time
	// Returns the event's optional value string.
	String() string
	// Returns the event's optional value as vars.Value
	Value() vars.Value
	// Returns the event's optional payload.
	Payload() *vars.ReadOnlyMap
	// Creates a new event with the given optional value and payload.
	Create(value any, payload *vars.Map) Event
}

func New

func New(scope, key string) Event

type Listener

type Listener[SESS context.Context] interface {
	OnEvent(scope, key string, cb ActionWithEvent[SESS])
	OnAnyEvent(cb ActionWithEvent[SESS])
}

Jump to

Keyboard shortcuts

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