event

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package event. event provides a strongly-typed event bus system for decoupling core logic from side effects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type      EventType      // Strongly-typed event identifier
	Timestamp time.Time      // When the event occurred
	Data      any            // Event-specific payload
	Metadata  map[string]any // Additional context (e.g., request ID, user agent)
}

Event represents a generic event that flows through the system.

func NewEvent

func NewEvent(eventType EventType, data any) *Event

NewEvent creates a new event with the given type and data.

func (*Event) WithMetadata

func (e *Event) WithMetadata(key string, value any) *Event

WithMetadata adds metadata to the event and returns the event for chaining.

type EventType

type EventType string

EventType represents a strongly-typed event identifier to prevent typos and ensure consistency.

Directories

Path Synopsis
Package batch.
Package batch.
Package bus.
Package bus.
Package errors provides standard error types for the Gossip event system.
Package errors provides standard error types for the Gossip event system.
Package filter.
Package filter.
Package middleware.
Package middleware.
Package sub.
Package sub.

Jump to

Keyboard shortcuts

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