Documentation
¶
Index ¶
- type Args
- type ExecutionContext
- func (e *ExecutionContext) Context() context.Context
- func (e *ExecutionContext) GetStepResult(stepName string) (StepResult, bool)
- func (e *ExecutionContext) NewStep(name string, args Args) *Step
- func (e *ExecutionContext) SetStepResult(stepName string, result StepResult)
- func (e *ExecutionContext) SnapshotSteps() map[string]StepResult
- func (e *ExecutionContext) WithContext(ctx context.Context) *ExecutionContext
- type ExecutionContextOption
- type RequestState
- type Step
- type StepHandler
- type StepResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Args ¶
Args represents evaluated arguments passed to a Go step from an HCL manifest.
func (Args) Get ¶
Get retrieves the argument at key and converts it to type T. Returns (zero, false) if the key is missing, null, or incompatible.
Example:
lat, ok := step.Args.Get[float64]("latitude")
role, ok := step.Args.Get[string]("role")
meta, ok := step.Args.Get[map[string]any]("metadata")
func (Args) GetOr ¶
GetOr is like Get but returns a fallback if key is missing or null.
port := step.Args.GetOr("port", 8080) // Inferred as int
host := step.Args.GetOr("host", "localhost") // Inferred as string
priority := step.Args.GetOr("priority", false) // Inferred as bool
ratio := step.Args.GetOr("ratio", 0.95) // Inferred as float64
type ExecutionContext ¶
type ExecutionContext struct {
Request *RequestState `json:"request"`
Steps map[string]StepResult `json:"steps"`
TimestampEpoch int64 `json:"timestamp_epoch"`
IngressTime time.Time `json:"-"`
Server manifest.Server `json:"-"`
RawRequest *http.Request `json:"-"`
// contains filtered or unexported fields
}
ExecutionContext encapsulates the runtime state for a single HTTP request pipeline execution.
func NewExecutionContext ¶
func NewExecutionContext(w http.ResponseWriter, r *http.Request, opts ...ExecutionContextOption) (*ExecutionContext, error)
NewExecutionContext parses the incoming HTTP request, enforces body limits, and initializes state.
func (*ExecutionContext) Context ¶
func (e *ExecutionContext) Context() context.Context
Context returns the underlying standard Go request context.
func (*ExecutionContext) GetStepResult ¶
func (e *ExecutionContext) GetStepResult(stepName string) (StepResult, bool)
GetStepResult safely retrieves prior step output (concurrent-safe).
func (*ExecutionContext) NewStep ¶
func (e *ExecutionContext) NewStep(name string, args Args) *Step
NewStep creates an isolated, thread-safe Step invocation referencing this ExecutionContext.
func (*ExecutionContext) SetStepResult ¶
func (e *ExecutionContext) SetStepResult(stepName string, result StepResult)
SetStepResult safely records the output of a step (concurrent-safe for parallel execution).
func (*ExecutionContext) SnapshotSteps ¶
func (e *ExecutionContext) SnapshotSteps() map[string]StepResult
SnapshotSteps returns a shallow copy of all step results recorded so far. Use this when passing steps to the HCL evaluation engine to prevent concurrent map read/write panics.
func (*ExecutionContext) WithContext ¶
func (e *ExecutionContext) WithContext(ctx context.Context) *ExecutionContext
WithContext returns a shallow copy of ExecutionContext with an updated standard library context.
type ExecutionContextOption ¶
type ExecutionContextOption func(*executionContextConfig)
ExecutionContextOption configures optional behavior during context creation.
func WithPathParams ¶
func WithPathParams(paramNames []string) ExecutionContextOption
WithPathParams configures route parameter names to extract from the request.
func WithServer ¶
func WithServer(server manifest.Server) ExecutionContextOption
WithServer attaches the resolved server configuration to the execution context.
type RequestState ¶
type RequestState struct {
Method string `json:"method"`
Path map[string]string `json:"path"`
Query map[string]string `json:"query"`
Headers map[string]string `json:"headers"`
Body any `json:"body"`
}
RequestState represents normalized HTTP request metadata extracted at runtime.
func (*RequestState) Header ¶
func (r *RequestState) Header(key string) string
Header returns the header value for key (case-insensitive).
func (*RequestState) PathParam ¶
func (r *RequestState) PathParam(key string, fallback ...string) string
PathParam returns the route path parameter value, or fallback if absent.
func (*RequestState) QueryParam ¶
func (r *RequestState) QueryParam(key string, fallback ...string) string
QueryParam returns the query parameter value, or fallback if absent.
type Step ¶
type Step struct {
*ExecutionContext
Name string `json:"name"`
Args Args `json:"args"`
}
Step encapsulates the invocation state and arguments for a single Go step.
type StepHandler ¶
StepHandler defines the signature for custom native Go step callbacks.
type StepResult ¶
StepResult represents arbitrary step-specific outputs.