engine

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args added in v0.2.0

type Args map[string]any

Args represents evaluated arguments passed to a Go step callback.

func (Args) Bind added in v0.2.0

func (a Args) Bind(dst any) error

Bind marshals and unmarshals arguments directly into a destination struct pointer.

func (Args) Get added in v0.2.0

func (a Args) Get[T any](key string) (T, bool)

Get retrieves the argument at key and converts it to type T with scalar coercion.

func (Args) GetOr added in v0.2.0

func (a Args) GetOr[T any](key string, fallback T) T

GetOr retrieves the argument at key or returns fallback if absent or incompatible.

func (Args) Has added in v0.2.0

func (a Args) Has(key string) bool

Has reports whether key exists in the arguments map and is not nil.

func (Args) Slice added in v0.2.0

func (a Args) Slice[T any](key string) []T

Slice retrieves an array of type T at key, safely coercing dynamic slices.

type Context added in v0.2.0

type Context struct {
	// contains filtered or unexported fields
}

Context encapsulates request metadata, body data, and pipeline step execution results.

func NewContext added in v0.2.0

func NewContext(r *http.Request, routePattern string, maxBytes int64) (*Context, error)

NewContext builds an execution context enforcing bounded body reads.

func (*Context) EvalAny added in v0.2.0

func (c *Context) EvalAny(expr hcl.Expression) (any, error)

EvalAny evaluates an HCL expression into a native Go value.

func (*Context) EvalBool added in v0.2.0

func (c *Context) EvalBool(expr hcl.Expression) (bool, error)

EvalBool evaluates an HCL expression expecting a boolean outcome.

func (*Context) EvalContext added in v0.2.0

func (c *Context) EvalContext() *hcl.EvalContext

EvalContext constructs the live HCL evaluation context containing request and step data.

func (*Context) RequestContext added in v0.2.0

func (c *Context) RequestContext() context.Context

RequestContext returns the standard request context.

func (*Context) SetStepResult added in v0.2.0

func (c *Context) SetStepResult(name string, res any)

SetStepResult registers outputs from an executed step into the context.

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine coordinates routing, connection pools, and pipeline step execution.

func New

func New(cfg *config.Config, opts ...Option) (*Engine, error)

New initializes an Engine from a verified Config and functional options.

func (*Engine) Close

func (e *Engine) Close() error

Close gracefully closes all active database pools and cache connections.

func (*Engine) SQL added in v0.2.0

func (e *Engine) SQL(name string) (*sql.DB, bool)

SQL returns a managed *sql.DB connection pool by connection name.

func (*Engine) ServeHTTP added in v0.2.0

func (e *Engine) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP satisfies the standard http.Handler interface through the telemetry middleware.

func (*Engine) Valkey added in v0.2.0

func (e *Engine) Valkey(name string) (valkey.Client, bool)

Valkey returns an active Valkey client by connection name.

type Option added in v0.2.0

type Option func(*Engine)

Option configures an Engine instance.

func WithLogger added in v0.2.0

func WithLogger(logger *slog.Logger) Option

WithLogger sets the structured logger for the engine.

func WithStep added in v0.2.0

func WithStep(name string, h StepHandler) Option

WithStep registers a named Go step callback.

func WithValkey added in v0.2.0

func WithValkey(name string, client valkey.Client) Option

WithValkey registers an existing Valkey client instance by connection name.

type Step added in v0.1.3

type Step struct {
	Name    string
	Args    Args
	Request *http.Request
}

Step represents the runtime state provided to a Go step callback.

type StepHandler added in v0.2.0

type StepHandler func(ctx context.Context, step *Step) (any, error)

StepHandler defines custom Go step function signatures.

Jump to

Keyboard shortcuts

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