RESPHandle

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 8 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ExpectNumber   = &ProtocolError{"Expect Number"}
	ExpectNewLine  = &ProtocolError{"Expect Newline"}
	ExpectTypeChar = &ProtocolError{"Expect TypeChar"}

	InvalidNumArg   = errors.New("TooManyArg")
	InvalidBulkSize = errors.New("Invalid bulk size")
	LineTooLong     = errors.New("LineTooLong")

	MaxNumArg = 256
	// A String value can be at max 512 Megabytes in length. redis:https://redis.io/topics/data-types
	MaxBulkSize   = 512000000
	MaxTelnetLine = 1 << 10
)

Functions

func SendBulk

func SendBulk(w *bufio.Writer, val []byte) error

func SendBulkString

func SendBulkString(w *bufio.Writer, str string) error

func SendBulkStrings

func SendBulkStrings(w *bufio.Writer, strs []string) error

func SendBulks

func SendBulks(w *bufio.Writer, vals [][]byte) error

func SendError

func SendError(w *bufio.Writer, msg string) error

func SendInt

func SendInt(w *bufio.Writer, val int64) error

func SendObjects

func SendObjects(w *bufio.Writer, vals []interface{}) error

func SendString

func SendString(w *bufio.Writer, msg string) error

Types

type Command

type Command struct {
	Argv [][]byte
	Raw  []byte
	// contains filtered or unexported fields
}

func (*Command) ArgCount

func (c *Command) ArgCount() int

func (*Command) Get

func (c *Command) Get(index int) []byte

func (*Command) IsLast

func (c *Command) IsLast() bool

type Handle

type Handle struct {
	Parser *ParserHandle
	Writer *WriterHandle
}

func NewHandle

func NewHandle(reader io.Reader, writer io.Writer) *Handle

type ParserHandle

type ParserHandle struct {
	*utils.Reader
}

func NewParserHandle

func NewParserHandle(reader io.Reader) *ParserHandle

func (*ParserHandle) Commands

func (r *ParserHandle) Commands() <-chan *Command

func (*ParserHandle) ReadCommand

func (r *ParserHandle) ReadCommand() (*Command, error)

type ProtocolError

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

func (*ProtocolError) Error

func (p *ProtocolError) Error() string

type WriterHandle

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

func NewWriterHandle

func NewWriterHandle(sink io.Writer) *WriterHandle

func (*WriterHandle) Flush

func (w *WriterHandle) Flush() error

func (*WriterHandle) RecursivelyWriteObjects

func (w *WriterHandle) RecursivelyWriteObjects(objs ...interface{}) error

func (*WriterHandle) Write

func (w *WriterHandle) Write(data []byte) (int, error)

func (*WriterHandle) WriteBulk

func (w *WriterHandle) WriteBulk(val []byte) error

func (*WriterHandle) WriteBulkString

func (w *WriterHandle) WriteBulkString(s string) error

func (*WriterHandle) WriteBulkStrings

func (w *WriterHandle) WriteBulkStrings(bulks []string) error

func (*WriterHandle) WriteBulks

func (w *WriterHandle) WriteBulks(bulks ...[]byte) error

func (*WriterHandle) WriteError

func (w *WriterHandle) WriteError(s string) error

func (*WriterHandle) WriteInt

func (w *WriterHandle) WriteInt(val int64) error

func (*WriterHandle) WriteObjects

func (w *WriterHandle) WriteObjects(objs ...interface{}) error

func (*WriterHandle) WriteSimpleString

func (w *WriterHandle) WriteSimpleString(s string) error

Jump to

Keyboard shortcuts

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