dispatch

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractJSONArgument

func ExtractJSONArgument(args []string, jsonIndex int) (string, bool)

Types

type ConnEnv

type ConnEnv struct {
	SubscribeConfigYAML   func() (int64, error)
	UnsubscribeConfigYAML func() (int64, error)
	IsSubscribed          func() bool
}

type Env

type Env struct {
	Runtime *home.Runtime
	Conn    *ConnEnv

	// ClientIP is the remote TCP client's IP address as resolved by the RESP server.
	// It can be empty when the address cannot be resolved.
	ClientIP string
}

type Handler

type Handler func(ctx context.Context, env Env, args []string) Reply

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Execute

func (r *Registry) Execute(ctx context.Context, env Env, args []string) Reply

func (*Registry) RegisterDirect

func (r *Registry) RegisterDirect(command string, key string, handler Handler) error

func (*Registry) RegisterDynamic

func (r *Registry) RegisterDynamic(command string, typeValue string, handler Handler) error

func (*Registry) Routes

func (r *Registry) Routes() []Route

func (*Registry) SetDirectDefault

func (r *Registry) SetDirectDefault(command string, handler Handler) error

func (*Registry) SetDynamicDefault

func (r *Registry) SetDynamicDefault(command string, handler Handler) error

type Reply

type Reply struct {
	Kind ReplyKind

	SimpleString string
	BulkString   []byte
	RedisError   string
	Integer      int64
	Array        []Reply
}

func Array

func Array(elements ...Reply) Reply

func BulkString

func BulkString(payload []byte) Reply

func Err

func Err(message string) Reply

func Integer

func Integer(value int64) Reply

func RedisError

func RedisError(message string) Reply

func SimpleString

func SimpleString(value string) Reply

type ReplyKind

type ReplyKind int
const (
	ReplyKindSimpleString ReplyKind = iota
	ReplyKindBulkString
	ReplyKindRedisError
	ReplyKindInteger
	ReplyKindArray
)

type Route

type Route struct {
	Kind      RouteKind
	Command   string
	Key       string
	Type      string
	IsDefault bool
}

type RouteKind

type RouteKind int
const (
	RouteKindDirect RouteKind = iota
	RouteKindDynamic
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL