Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTooManyHandle = errors.Errorf("too many handlers, at most '%d' handlers is allowed", abortIndex) ErrNoHandle = errors.New("chain has no handlers, forget call Use()?") )
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain represents a chain of handlers.
type Context ¶
type Context interface { Temporary Abort() // Abort the chain execution. AbortWithError(err error) // Abort the chain execution with a custom error. IsAborted() bool // Check if the chain execution is aborted. Next() // Continue to the next handler in the chain. }
Context defines the interface for the context passed through the chain.
type Handler ¶
type Handler interface {
Execute(ctx Context)
}
Handler defines the interface for a chain handler.
type UnaryHandler ¶ added in v0.3.12
type UnaryInterceptor ¶ added in v0.3.12
type UnaryInterceptor[T any] func(ctx context.Context, in T, handler UnaryHandler[T]) (resp any, err error)
func ChainUnaryInterceptors ¶ added in v0.3.12
func ChainUnaryInterceptors[T any](interceptors []UnaryInterceptor[T]) UnaryInterceptor[T]
Click to show internal directories.
Click to hide internal directories.