redis

package
v1.10.8 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StringType  = '+'
	ErrType     = '-'
	IntegerType = ':'
	BulkType    = '$'
	ArrayType   = '*'
	MapType     = '%'
	DoubleType  = ','
	NullType    = '_'
)
View Source
const (
	MultiNone    uint8 = 0
	MultiPrepare uint8 = 1
	MultiCommit  uint8 = 2
	MultiError   uint8 = 4
)

Variables

View Source
var (
	ErrInvalidRequestExceptedArray       = errors.New("invalid request, expected array")
	ErrInvalidRequestExceptedArrayLength = errors.New("invalid request, expected array length")
	ErrInvalidRequestExceptedBulk        = errors.New("invalid request, expected bulk")
)
View Source
var ClientNum atomic.Int64

Functions

func FormatFloat64 added in v1.6.0

func FormatFloat64(s string) (float64, error)

func FormatInt64 added in v1.6.0

func FormatInt64(s string) (int64, error)

func Serve

func Serve(addr string, handler HandlerFunc) error

Types

type Command added in v1.6.0

type Command struct {
	Name    string
	Args    []string
	Options Options
}

type Conn added in v1.6.0

type Conn struct {
	*Reader
	*Writer
	Network   net.Conn
	Commands  []func()
	State     uint8
	WatchKeys btree.Map[string, bool]
}

type HandlerFunc added in v1.6.0

type HandlerFunc func(c *Conn, cmd Command)

type Options added in v1.6.0

type Options struct {
	NX         int
	XX         int
	KEEPTTL    int
	GET        int
	LT         int
	GT         int
	CH         int
	INCR       int
	WITHSCORES int
	EX         int
	PX         int
	EXAT       int
	PXAT       int
	MATCH      int
	COUNT      int
	BYLEX      int
	BYSCORE    int
	LIMIT      int
	BYTE       int
	BIT        int
	NUMKEYS    int
	WEIGHTS    int
	AGGREGATE  int
	REV        int
	TYPE       int
	M          int
	KM         int
	FT         int
	MI         int
	ASC        int
	DESC       int
	ANY        int
	WITHCOORD  int
	WITHDIST   int
	WITHHASH   int
}

type Reader added in v1.6.0

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

func NewReader added in v1.6.0

func NewReader(rd io.Reader) *Reader

func (*Reader) ReadCommand added in v1.6.0

func (r *Reader) ReadCommand() error

func (*Reader) ReadInlineCommand added in v1.6.0

func (r *Reader) ReadInlineCommand() error

type Writer

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

Writer is a RESP writer

func NewWriter

func NewWriter(w io.Writer) *Writer

func (*Writer) Bytes added in v1.6.0

func (w *Writer) Bytes() []byte

func (*Writer) Flush added in v1.6.0

func (w *Writer) Flush() error

func (*Writer) HasError added in v1.6.0

func (w *Writer) HasError() bool

func (*Writer) RemoteAddr added in v1.6.0

func (w *Writer) RemoteAddr() string

func (*Writer) WriteArray added in v1.6.0

func (w *Writer) WriteArray(l int)

func (*Writer) WriteArrayNull added in v1.6.0

func (w *Writer) WriteArrayNull()

func (*Writer) WriteBulk added in v1.6.0

func (w *Writer) WriteBulk(bulk string)

func (*Writer) WriteBulkNull added in v1.6.0

func (w *Writer) WriteBulkNull()

func (*Writer) WriteDouble added in v1.6.0

func (w *Writer) WriteDouble(v float64)

func (*Writer) WriteError added in v1.6.0

func (w *Writer) WriteError(err string)

func (*Writer) WriteInt64 added in v1.8.0

func (w *Writer) WriteInt64(v int64)

func (*Writer) WriteMap added in v1.6.0

func (w *Writer) WriteMap(n int)

func (*Writer) WriteNullMap added in v1.6.0

func (w *Writer) WriteNullMap()

func (*Writer) WriteOK added in v1.6.0

func (w *Writer) WriteOK()

func (*Writer) WriteString added in v1.6.0

func (w *Writer) WriteString(str string)

func (*Writer) WriteUInt64 added in v1.8.0

func (w *Writer) WriteUInt64(v uint64)

Jump to

Keyboard shortcuts

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