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 NilRPCRegister(opts RPCConfig, handler any, meta CommandMeta) 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 RPCCommand
- type RPCConfig
- type RPCDescriber
- type RPCDescription
- 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
- func (r *Registry) SetRPCRegister(fn func(opts RPCConfig, handler any, meta CommandMeta) 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 NilRPCRegister ¶ added in v0.15.0
func NilRPCRegister(opts RPCConfig, handler any, meta CommandMeta) error
NilRPCRegister is a noop RPC registration function.
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 RPCCommand ¶ added in v0.15.0
RPCCommand allows commands/queries to opt into RPC registration.
type RPCConfig ¶ added in v0.15.0
type RPCConfig struct {
// Method is the RPC method name, e.g. "fsm.apply_event".
Method string
// Timeout is an optional transport timeout hint.
Timeout time.Duration
// Streaming declares whether this endpoint is stream oriented.
Streaming bool
// Idempotent declares whether retries are generally safe.
Idempotent bool
// Permissions required to invoke this method.
Permissions []string
// Roles allowed to invoke this method.
Roles []string
// Summary is a short endpoint description for docs/discovery.
Summary string
// Description is a longer endpoint description for docs/discovery.
Description string
// Tags groups endpoint in generated clients/docs.
Tags []string
// Deprecated marks endpoint for phased removal.
Deprecated bool
// Since captures the version this endpoint was introduced.
Since string
}
RPCConfig declares optional transport level metadata for RPC exposure. The zero value is safe and keeps behavior minimally configured.
type RPCDescriber ¶ added in v0.15.0
type RPCDescriber interface {
RPCDescription() RPCDescription
}
RPCDescriber allows commands to expose richer endpoint metadata for docs/codegen. This is optional and only used by RPC resolver paths.
type RPCDescription ¶ added in v0.15.0
type RPCDescription struct {
Summary string
Description string
Tags []string
Deprecated bool
Since string
}
RPCDescription carries optional endpoint documentation metadata.
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
func (*Registry) SetRPCRegister ¶ added in v0.15.0
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 |
|---|---|
|
cmd
|
|
|
rpc-tsgen
command
|
|
|
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
|
|
|
rpc/tsgen
command
|
|
|
rpc/web_debug
command
|
|