Documentation
¶
Overview ¶
Package hook provides the `@hook:name` directive, which attaches every named hook from the kernel registry to the compiled pipeline, and the hook.probe action that reads HookProbeKey from the context to prove a hook fired.
The bundle registers the reserved "hook.verify" hook, which sets HookProbeKey in the request context. Fixtures use it to confirm that @hook actually attached something.
Typical use:
@hook:hook.verify
{ test: "data" } -> hook.probe
Index ¶
Constants ¶
const ID = "hook"
Variables ¶
var Directive = core.Directive{
Name: "hook",
Example: "@hook:hook.verify",
Handler: handleDirective,
}
Directive parses `@hook:name1,name2` and appends every name to meta["hooks"]. WrapPipeline consumes the list.
var HookProbeKey = xctx.NewKey[bool]("flow.hook.probe")
HookProbeKey is the context key set by the hook.verify hook. The probe action reads it; fixtures assert on the result.
Functions ¶
func ProbeAction ¶
ProbeAction reads HookProbeKey from the context and returns it as part of the typed result. Used by fixtures to prove a hook ran.