compute

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SetCommandName = "SET"
	GetCommandName = "GET"
	DelCommandName = "DEL"
)

Variables

View Source
var (
	OKResponse = Response{/* contains filtered or unexported fields */}

	NotFoundResponse        = Response{/* contains filtered or unexported fields */}
	ParseQueryErrorResponse = Response{/* contains filtered or unexported fields */}
	InternalErrorResponse   = Response{/* contains filtered or unexported fields */}
)

Functions

This section is empty.

Types

type CommandID

type CommandID int
const (
	SetCommandID CommandID = iota + 1
	GetCommandID
	DelCommandID
)

func (CommandID) String

func (c CommandID) String() string

type Query

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

func ParseQuery

func ParseQuery(rawQuery string) (Query, error)

func (Query) Args

func (q Query) Args() []string

func (Query) CommandID

func (q Query) CommandID() CommandID

type QueryHandler

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

func NewQueryHandler

func NewQueryHandler(logger *slog.Logger, store Storage) *QueryHandler

func (*QueryHandler) Handle

func (h *QueryHandler) Handle(ctx context.Context, req []byte) []byte

type Response

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

func (Response) Bytes added in v1.2.0

func (r Response) Bytes() []byte

func (Response) String

func (r Response) String() string

func (Response) WithErr

func (r Response) WithErr(err error) Response

func (Response) WithValue

func (r Response) WithValue(v string) Response

type Storage

type Storage interface {
	Set(ctx context.Context, key, value string) error
	Get(ctx context.Context, key string) (string, error)
	Del(ctx context.Context, key string) error
}

Jump to

Keyboard shortcuts

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