redis

package
v0.0.0-...-13a9703 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadRespCRLFEnd  = errors.New("bad resp CRLF end")
	ErrBadRespBytesLen = errors.New("bad resp bytes len")
	ErrBadRespArrayLen = errors.New("bad resp array len")
)

Functions

func AsBulkBytes

func AsBulkBytes(r Resp, err error) ([]byte, error)

func AsError

func AsError(r Resp, err error) ([]byte, error)

func AsInt

func AsInt(r Resp, err error) (int64, error)

func AsString

func AsString(r Resp, err error) ([]byte, error)

func Encode

func Encode(w *bufio.Writer, r Resp, flush bool) error

func EncodeToBytes

func EncodeToBytes(r Resp) ([]byte, error)

func EncodeToString

func EncodeToString(r Resp) (string, error)

func MustEncode

func MustEncode(w *bufio.Writer, r Resp)

func MustEncodeToBytes

func MustEncodeToBytes(r Resp) []byte

func MustHandlerTable

func MustHandlerTable(o interface{}) map[string]HandlerFunc

func NewHandlerTable

func NewHandlerTable(o interface{}) (map[string]HandlerFunc, error)

func ParseArgs

func ParseArgs(resp Resp) (cmd string, args [][]byte, err error)

Types

type Array

type Array struct {
	Value []Resp
}

func NewArray

func NewArray() *Array

func (*Array) Append

func (r *Array) Append(a Resp)

func (*Array) AppendBulkBytes

func (r *Array) AppendBulkBytes(b []byte)

func (*Array) AppendInt

func (r *Array) AppendInt(n int64)

type BulkBytes

type BulkBytes struct {
	Value []byte
}

func NewBulkBytes

func NewBulkBytes(p []byte) *BulkBytes

type Decoder

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

func NewDecoder

func NewDecoder(r *bufio.Reader) *Decoder

type Error

type Error struct {
	//Value string
	Value []byte
}

type HandlerFunc

type HandlerFunc func(arg0 interface{}, args ...[]byte) (Resp, error)

type HandlerTable

type HandlerTable map[string]HandlerFunc

type Int

type Int struct {
	Value int64
}

func NewInt

func NewInt(n int64) *Int

type Resp

type Resp interface {
}

func AsArray

func AsArray(r Resp, err error) ([]Resp, error)

func ChangeArgsToResp

func ChangeArgsToResp(cmd []byte, args [][]byte) (resp Resp)

func Decode

func Decode(r *bufio.Reader) (Resp, error)

func DecodeFromBytes

func DecodeFromBytes(p []byte) (Resp, error)

func MustDecode

func MustDecode(r *bufio.Reader) Resp

func MustDecodeFromBytes

func MustDecodeFromBytes(p []byte) Resp

func MustDecodeOpt

func MustDecodeOpt(d *Decoder) (Resp, int64)

return the response and current reading offset

func NewCommand

func NewCommand(cmd string, args ...interface{}) Resp

type Server

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

func MustServer

func MustServer(o interface{}) *Server

func NewServer

func NewServer(o interface{}) (*Server, error)

func NewServerWithTable

func NewServerWithTable(t HandlerTable) (*Server, error)

func (*Server) Dispatch

func (s *Server) Dispatch(arg0 interface{}, resp Resp) (Resp, error)

type String

type String struct {
	//Value string
	Value []byte
}

Jump to

Keyboard shortcuts

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