engine

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine[T, R any] struct {
	// contains filtered or unexported fields
}

Engine is a generic engine that can be used to run a chain of decorators and a handler.

func New

func New[T, R any](ctx context.Context, evt T, handler engine.Handler[T, R]) *Engine[T, R]

New creates a new engine with the given context, event and handler.

func (*Engine[T, R]) Run

func (e *Engine[T, R]) Run() (R, error)

Run executes the engine and returns the result of the handler.

func (*Engine[T, R]) Use

func (e *Engine[T, R]) Use(decorators ...engine.Decorator[T, R]) *Engine[T, R]

Use adds a list of decorators to the engine.

Jump to

Keyboard shortcuts

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