Documentation
¶
Index ¶
- func ValidateIngress(ctx *Context, rules *manifest.Request, schemas map[string]manifest.Schema) *problem.Problem
- type Context
- func (c *Context) Body() any
- func (c *Context) BodyMalformed() bool
- func (c *Context) GoHandler(name string) (manifest.StepHandler, error)
- func (c *Context) HTTPClient() *http.Client
- func (c *Context) OpenAPISpec(format string) ([]byte, string, error)
- func (c *Context) ResponseController() *http.ResponseController
- func (c *Context) ResponseWriter() http.ResponseWriter
- func (c *Context) SQL(name string) (*sql.DB, error)
- func (c *Context) Schemas() map[string]manifest.Schema
- func (c *Context) Scope() manifest.Scope
- func (c *Context) SetBody(body any)
- func (c *Context) SetPathParam(name string, val any)
- func (c *Context) SetQueryParam(name string, val any)
- func (c *Context) SetStepResult(name string, result any)
- func (c *Context) Telemetry() *telemetry.Telemetry
- func (c *Context) Valkey(name string) (valkey.Client, error)
- type Dependencies
- type Engine
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateIngress ¶ added in v0.2.1
func ValidateIngress(ctx *Context, rules *manifest.Request, schemas map[string]manifest.Schema) *problem.Problem
ValidateIngress validates path, query, header, and body parameters against configured request rules. Valid scalar path and query parameters are coerced to native Go types (int64, float64, bool) in place.
Types ¶
type Context ¶ added in v0.2.0
type Context struct {
// contains filtered or unexported fields
}
Context encapsulates the runtime execution state and dependency provider for a single HTTP request. It implements manifest.StepExecutionContext.
func NewContext ¶ added in v0.2.0
func NewContext( r *http.Request, w http.ResponseWriter, routePattern string, maxBodySize int64, deps Dependencies, ) (*Context, error)
NewContext constructs an execution context, enforcing body boundaries, normalizing headers, and capturing a frozen reference timestamp that remains immutable throughout the request lifecycle.
func (*Context) BodyMalformed ¶ added in v0.2.1
BodyMalformed reports whether the incoming JSON payload contained syntax errors.
func (*Context) GoHandler ¶ added in v0.2.1
func (c *Context) GoHandler(name string) (manifest.StepHandler, error)
GoHandler implements manifest.StepExecutionContext and returns a registered Go callback.
func (*Context) HTTPClient ¶ added in v0.2.1
HTTPClient implements manifest.StepExecutionContext.
func (*Context) OpenAPISpec ¶ added in v0.2.1
OpenAPISpec implements manifest.StepExecutionContext and returns the precompiled specification and ETag.
func (*Context) ResponseController ¶ added in v0.2.1
func (c *Context) ResponseController() *http.ResponseController
ResponseController implements manifest.StepExecutionContext.
func (*Context) ResponseWriter ¶ added in v0.2.1
func (c *Context) ResponseWriter() http.ResponseWriter
ResponseWriter implements manifest.StepExecutionContext.
func (*Context) SQL ¶ added in v0.2.1
SQL implements manifest.StepExecutionContext and returns a managed database pool by name.
func (*Context) Schemas ¶ added in v0.2.1
Schemas implements manifest.StepExecutionContext.
func (*Context) Scope ¶ added in v0.2.1
Scope implements manifest.StepExecutionContext and constructs an immutable expression evaluation scope.
func (*Context) SetBody ¶ added in v0.2.1
SetBody replaces the body payload, typically after defaults injection during ingress validation.
func (*Context) SetPathParam ¶ added in v0.2.1
SetPathParam assigns a coerced scalar value to a path parameter coordinate.
func (*Context) SetQueryParam ¶ added in v0.2.1
SetQueryParam assigns a coerced scalar or slice value to a query parameter coordinate.
func (*Context) SetStepResult ¶ added in v0.2.0
SetStepResult records a completed step's output under its published identifier.
type Dependencies ¶ added in v0.2.1
type Dependencies struct {
SQL map[string]*sql.DB
Valkey map[string]valkey.Client
Handlers map[string]manifest.StepHandler
Schemas map[string]manifest.Schema
Spec *openapi.Spec
HTTPClient *http.Client
Telemetry *telemetry.Telemetry
}
Dependencies provides runtime connection pools, handlers, schemas, specifications, and telemetry instrumentation to Context.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine coordinates HTTP routing, connection pool lifecycles, and request execution. It implements the standard http.Handler interface.
func New ¶
New initializes an Engine from a validated manifest.Manifest, opening connection pools, configuring telemetry, precompiling OpenAPI specifications, and binding routes.
func (*Engine) Close ¶
Close cleanly terminates all managed database pools, Valkey clients, and idle outbound HTTP connections.
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 by dispatching through telemetry middleware.
func (*Engine) Telemetry ¶ added in v0.2.1
Telemetry returns the active telemetry.Telemetry instance managing logging and tracing.
type Option ¶ added in v0.2.0
type Option func(*Engine)
Option configures an Engine during initialization.
func WithGoHandler ¶ added in v0.2.1
func WithGoHandler(name string, h manifest.StepHandler) Option
WithGoHandler registers a custom native Go callback by its identifier.
func WithHTTPClient ¶ added in v0.2.1
WithHTTPClient overrides the default HTTP client used for outbound requests.
func WithTelemetry ¶ added in v0.2.1
WithTelemetry overrides the default telemetry instance configured by the manifest.