Documentation
¶
Index ¶
- Variables
- func ContextWithResult[T any](ctx context.Context, result *Result[T]) context.Context
- func DefaultPanicLogger(funcName string, err any, stack []byte, fields ...map[string]any)
- func GetGoroutineID() uint64
- func GetMessageType(msg any) string
- func IsNilMessage(msg any) bool
- func MakePanicHandler(logger PanicLogger) func(funcName string, fields ...map[string]any)
- func NilCronRegister(opts HandlerConfig, handler any) error
- func ValidateMessage(msg any) error
- type CLICommand
- type CLIConfig
- type CLIGroup
- type CommandExposure
- type CommandFunc
- type CommandMeta
- type Commander
- type CronCommand
- type ExposableCommand
- type HTTPCommand
- type HandlerConfig
- type Message
- type MessageFactory
- type PanicLogger
- type Querier
- type QueryFunc
- type Registry
- func (r *Registry) AddResolver(key string, res Resolver) error
- func (r *Registry) GetCLIOptions() ([]kong.Option, error)
- func (r *Registry) HasResolver(key string) bool
- func (r *Registry) Initialize() error
- func (r *Registry) RegisterCommand(cmd any) error
- func (r *Registry) SetCronRegister(fn func(opts HandlerConfig, handler any) error) *Registry
- type Resolver
- type Result
- type ResultKey
Constants ¶
This section is empty.
Variables ¶
var ErrValidation = errors.New("validation error", errors.CategoryValidation).
WithTextCode("VALIDATION_FAILED")
ErrValidation is a sentinel error used to mark validation failures. Wrappers can compare errors with errors.Is(err, ErrValidation) to propagate validation intent through additional layers.
Functions ¶
func ContextWithResult ¶ added in v0.3.0
Context helpers
func DefaultPanicLogger ¶ added in v0.2.0
func GetGoroutineID ¶ added in v0.2.0
func GetGoroutineID() uint64
func GetMessageType ¶ added in v0.3.0
func IsNilMessage ¶
func MakePanicHandler ¶ added in v0.2.0
func MakePanicHandler(logger PanicLogger) func(funcName string, fields ...map[string]any)
func NilCronRegister ¶ added in v0.3.0
func NilCronRegister(opts HandlerConfig, handler any) error
func ValidateMessage ¶ added in v0.3.0
Types ¶
type CLICommand ¶ added in v0.3.0
type CLIConfig ¶ added in v0.3.0
type CommandExposure ¶ added in v0.13.0
type CommandExposure struct {
// ExposeInAdmin signals this command can be listed in go-admin UI/REPL.
ExposeInAdmin bool
// Tags for grouping/filtering in UI (e.g. "debug", "ops").
Tags []string
// Permissions required to execute (admin will enforce).
// If empty, consumers should derive defaults from Mutates.
Permissions []string
// Roles allowed to execute (optional).
Roles []string
// Mutates signals side effects; false implies read-only.
Mutates bool
}
CommandExposure declares optional UI/REPL exposure metadata. The zero value is safe: ExposeInAdmin is false and Mutates is read-only.
func ExposureOf ¶ added in v0.13.0
func ExposureOf(cmd any) (CommandExposure, bool)
ExposureOf returns exposure metadata if cmd implements ExposableCommand.
type CommandFunc ¶
CommandFunc is an adapter that lets you use a function as a CommandHandler[T]
type CommandMeta ¶ added in v0.11.0
func MessageTypeForCommand ¶ added in v0.11.0
func MessageTypeForCommand(cmd any) CommandMeta
type CronCommand ¶ added in v0.3.0
type CronCommand interface {
CronHandler() func() error
CronOptions() HandlerConfig
}
type ExposableCommand ¶ added in v0.13.0
type ExposableCommand interface {
Exposure() CommandExposure
}
ExposableCommand can be implemented by CLICommand (or any Command/Query). Opt-in is explicit: consumers should ignore commands that do not implement it or return ExposeInAdmin=false.
type HTTPCommand ¶ added in v0.3.0
type HTTPCommand interface {
HTTPHandler()
}
type HandlerConfig ¶ added in v0.3.0
type Message ¶
type Message interface {
Type() string
}
Message is the interface command and queries messages must implement
type MessageFactory ¶ added in v0.11.0
type MessageFactory interface {
MessageValue() any
}
MessageFactory provides a concrete message value for interface-based commands.
type PanicLogger ¶ added in v0.2.0
type Registry ¶ added in v0.3.0
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶ added in v0.3.0
func NewRegistry() *Registry
func (*Registry) AddResolver ¶ added in v0.11.0
func (*Registry) GetCLIOptions ¶ added in v0.3.0
func (*Registry) HasResolver ¶ added in v0.11.0
func (*Registry) Initialize ¶ added in v0.3.0
func (*Registry) RegisterCommand ¶ added in v0.3.0
func (*Registry) SetCronRegister ¶ added in v0.3.0
func (r *Registry) SetCronRegister(fn func(opts HandlerConfig, handler any) error) *Registry
type Result ¶ added in v0.3.0
type Result[T any] struct { // contains filtered or unexported fields }
Result collector implementation from before
func ResultFromContext ¶ added in v0.3.0
func (*Result[T]) GetMetadata ¶ added in v0.3.0
func (*Result[T]) StoreError ¶ added in v0.3.0
func (*Result[T]) StoreWithMeta ¶ added in v0.3.0
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
flow/batch_processing
command
|
|
|
flow/conditional_guard
command
|
|
|
flow/config_build
command
|
|
|
flow/dispatch_fanout
command
|
|
|
flow/metrics_decorator
command
|
|
|
flow/parallel_error_strategy
command
|
|
|
flow/resilience
command
|
|
|
flow/saga_compensation
command
|
|