Documentation
¶
Overview ¶
Package node provides reusable built-in node implementations for the graph engine.
Index ¶
- func Delay[S any](cfg DelayConfig) graph.NodeFunc[S]
- func HTTP[S any](cfg HTTPConfig[S]) graph.NodeFunc[S]
- func Noop[S any](_ context.Context, state S) (S, error)
- func NoopFunc[S any]() graph.NodeFunc[S]
- func Transform[S any](fn TransformFunc[S]) graph.NodeFunc[S]
- type DelayConfig
- type HTTPConfig
- type TransformFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delay ¶
func Delay[S any](cfg DelayConfig) graph.NodeFunc[S]
Delay pauses execution for cfg.Duration, then returns state unchanged. Respects context cancellation.
func HTTP ¶
func HTTP[S any](cfg HTTPConfig[S]) graph.NodeFunc[S]
HTTP builds a NodeFunc that makes an outbound HTTP call.
Types ¶
type DelayConfig ¶
DelayConfig configures a Delay node.
type HTTPConfig ¶
type HTTPConfig[S any] struct { Method string // GET, POST, … URL string // static URL; use URLFunc for dynamic URLFunc func(S) string // overrides URL if set Timeout time.Duration // BuildRequest lets callers customise headers and body from state. // If nil, a JSON-encoded state is used as the body for non-GET methods. BuildRequest func(ctx context.Context, state S, req *http.Request) error // ParseResponse merges the HTTP response into state. // If nil, the response body is discarded. ParseResponse func(ctx context.Context, state S, resp *http.Response) (S, error) }
HTTPConfig configures an HTTP node.
type TransformFunc ¶
TransformFunc is a pure function that maps one state to another.
Click to show internal directories.
Click to hide internal directories.