Documentation
¶
Index ¶
- Variables
- func AppendHandlers(ctx context.Context, info *RunInfo, handlers ...Handler) context.Context
- func EnsureRunInfo(ctx context.Context, typ string, comp components.Component) context.Context
- func InitCallbacks(ctx context.Context, info *RunInfo, handlers ...Handler) context.Context
- func On[T any](ctx context.Context, inOut T, handle Handle[T], timing CallbackTiming, ...) (context.Context, T)
- func OnEndHandle[T any](ctx context.Context, output T, runInfo *RunInfo, handlers []Handler) (context.Context, T)
- func OnEndWithStreamOutputHandle[T any](ctx context.Context, output *schema.StreamReader[T], runInfo *RunInfo, ...) (context.Context, *schema.StreamReader[T])
- func OnErrorHandle(ctx context.Context, err error, runInfo *RunInfo, handlers []Handler) (context.Context, error)
- func OnStartHandle[T any](ctx context.Context, input T, runInfo *RunInfo, handlers []Handler) (context.Context, T)
- func OnStartWithStreamInputHandle[T any](ctx context.Context, input *schema.StreamReader[T], runInfo *RunInfo, ...) (context.Context, *schema.StreamReader[T])
- func OnWithStreamHandle[S any](ctx context.Context, inOut S, handlers []Handler, cpy func(int) []S, ...) (context.Context, S)
- func ReuseHandlers(ctx context.Context, info *RunInfo) context.Context
- type CallbackInput
- type CallbackOutput
- type CallbackTiming
- type CtxManagerKey
- type CtxRunInfoKey
- type Handle
- type Handler
- type RunInfo
- type TimingChecker
Constants ¶
This section is empty.
Variables ¶
View Source
var GlobalHandlers []Handler
Functions ¶
func AppendHandlers ¶ added in v0.3.4
func EnsureRunInfo ¶ added in v0.3.27
func InitCallbacks ¶
func OnEndHandle ¶
func OnErrorHandle ¶
func OnStartHandle ¶
func OnWithStreamHandle ¶ added in v0.3.4
Types ¶
type CallbackInput ¶
type CallbackInput any
type CallbackOutput ¶
type CallbackOutput any
type CallbackTiming ¶
type CallbackTiming uint8
type CtxManagerKey ¶
type CtxManagerKey struct{}
type CtxRunInfoKey ¶ added in v0.3.28
type CtxRunInfoKey struct{}
type Handler ¶
type Handler interface {
OnStart(ctx context.Context, info *RunInfo, input CallbackInput) context.Context
OnEnd(ctx context.Context, info *RunInfo, output CallbackOutput) context.Context
OnError(ctx context.Context, info *RunInfo, err error) context.Context
OnStartWithStreamInput(ctx context.Context, info *RunInfo,
input *schema.StreamReader[CallbackInput]) context.Context
OnEndWithStreamOutput(ctx context.Context, info *RunInfo,
output *schema.StreamReader[CallbackOutput]) context.Context
}
type RunInfo ¶
type RunInfo struct {
// Name is the graph node name for display purposes, not unique.
// Passed from compose.WithNodeName().
Name string
Type string
Component components.Component
}
type TimingChecker ¶
type TimingChecker interface {
Needed(ctx context.Context, info *RunInfo, timing CallbackTiming) bool
}
Click to show internal directories.
Click to hide internal directories.