utils

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Map

func Map[T, V any](ts []T, fn func(T) V) []V

func Reduce

func Reduce[T, V any](ts []T, fn func(V, T) V, initial V) V

Types

type Emitter

type Emitter[T Event[V], V any] interface {
	Emit(event T)
	Subscribe(eventName goiamuniverse.Event, subscriber Subscriber[T, V])
}

func NewEmitter

func NewEmitter[T Event[V], V any]() Emitter[T, V]

NewEmitter creates a new Emitter instance for the specified event type.

type Event

type Event[T any] interface {
	Name() goiamuniverse.Event
	Payload() T
	Metadata() sdk.Metadata
	Context() context.Context
}

type Subscriber

type Subscriber[T Event[V], V any] interface {
	HandleEvent(event T)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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