protocol

package
v1.2.10 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CRLF = "\r\n"

CRLF is the line separator of redis serialization protocol

Functions

func IsEmptyMultiBulkReply

func IsEmptyMultiBulkReply(reply redis.Reply) bool

func IsErrorReply

func IsErrorReply(reply redis.Reply) bool

IsErrorReply returns true if the given protocol is error

func IsOKReply

func IsOKReply(reply redis.Reply) bool

IsOKReply returns true if the given protocol is +OK

Types

type ArgNumErrReply

type ArgNumErrReply struct {
	Cmd string
}

ArgNumErrReply represents wrong number of arguments for command

func MakeArgNumErrReply

func MakeArgNumErrReply(cmd string) *ArgNumErrReply

MakeArgNumErrReply represents wrong number of arguments for command

func (*ArgNumErrReply) Error

func (r *ArgNumErrReply) Error() string

func (*ArgNumErrReply) ToBytes

func (r *ArgNumErrReply) ToBytes() []byte

ToBytes marshals redis.Reply

type BulkReply

type BulkReply struct {
	Arg []byte
}

BulkReply stores a binary-safe string

func MakeBulkReply

func MakeBulkReply(arg []byte) *BulkReply

MakeBulkReply creates BulkReply

func (*BulkReply) ToBytes

func (r *BulkReply) ToBytes() []byte

ToBytes marshal redis.Reply

type EmptyMultiBulkReply

type EmptyMultiBulkReply struct{}

EmptyMultiBulkReply is a empty list

func MakeEmptyMultiBulkReply

func MakeEmptyMultiBulkReply() *EmptyMultiBulkReply

MakeEmptyMultiBulkReply creates EmptyMultiBulkReply

func (*EmptyMultiBulkReply) ToBytes

func (r *EmptyMultiBulkReply) ToBytes() []byte

ToBytes marshal redis.Reply

type ErrorReply

type ErrorReply interface {
	Error() string
	ToBytes() []byte
}

ErrorReply is an error and redis.Reply

type IntReply

type IntReply struct {
	Code int64
}

IntReply stores an int64 number

func MakeIntReply

func MakeIntReply(code int64) *IntReply

MakeIntReply creates int protocol

func (*IntReply) ToBytes

func (r *IntReply) ToBytes() []byte

ToBytes marshal redis.Reply

type MultiBulkReply

type MultiBulkReply struct {
	Args [][]byte
}

MultiBulkReply stores a list of string

func MakeMultiBulkReply

func MakeMultiBulkReply(args [][]byte) *MultiBulkReply

MakeMultiBulkReply creates MultiBulkReply

func (*MultiBulkReply) ToBytes

func (r *MultiBulkReply) ToBytes() []byte

ToBytes marshal redis.Reply

type MultiRawReply

type MultiRawReply struct {
	Replies []redis.Reply
}

MultiRawReply store complex list structure, for example GeoPos command

func MakeMultiRawReply

func MakeMultiRawReply(replies []redis.Reply) *MultiRawReply

MakeMultiRawReply creates MultiRawReply

func (*MultiRawReply) ToBytes

func (r *MultiRawReply) ToBytes() []byte

ToBytes marshal redis.Reply

type NoReply

type NoReply struct{}

NoReply respond nothing, for commands like subscribe

func (*NoReply) ToBytes

func (r *NoReply) ToBytes() []byte

ToBytes marshal redis.Reply

type NullBulkReply

type NullBulkReply struct{}

NullBulkReply is empty string

func MakeNullBulkReply

func MakeNullBulkReply() *NullBulkReply

MakeNullBulkReply creates a new NullBulkReply

func (*NullBulkReply) ToBytes

func (r *NullBulkReply) ToBytes() []byte

ToBytes marshal redis.Reply

type OkReply

type OkReply struct{}

OkReply is +OK

func MakeOkReply

func MakeOkReply() *OkReply

MakeOkReply returns a ok protocol

func (*OkReply) ToBytes

func (r *OkReply) ToBytes() []byte

ToBytes marshal redis.Reply

type PongReply

type PongReply struct{}

PongReply is +PONG

func (*PongReply) ToBytes

func (r *PongReply) ToBytes() []byte

ToBytes marshal redis.Reply

type ProtocolErrReply

type ProtocolErrReply struct {
	Msg string
}

ProtocolErrReply represents meeting unexpected byte during parse requests

func (*ProtocolErrReply) Error

func (r *ProtocolErrReply) Error() string

func (*ProtocolErrReply) ToBytes

func (r *ProtocolErrReply) ToBytes() []byte

ToBytes marshals redis.Reply

type QueuedReply

type QueuedReply struct{}

QueuedReply is +QUEUED

func MakeQueuedReply

func MakeQueuedReply() *QueuedReply

MakeQueuedReply returns a QUEUED protocol

func (*QueuedReply) ToBytes

func (r *QueuedReply) ToBytes() []byte

ToBytes marshal redis.Reply

type StandardErrReply

type StandardErrReply struct {
	Status string
}

StandardErrReply represents server error

func MakeErrReply

func MakeErrReply(status string) *StandardErrReply

MakeErrReply creates StandardErrReply

func (*StandardErrReply) Error

func (r *StandardErrReply) Error() string

func (*StandardErrReply) ToBytes

func (r *StandardErrReply) ToBytes() []byte

ToBytes marshal redis.Reply

type StatusReply

type StatusReply struct {
	Status string
}

StatusReply stores a simple status string

func MakeStatusReply

func MakeStatusReply(status string) *StatusReply

MakeStatusReply creates StatusReply

func (*StatusReply) ToBytes

func (r *StatusReply) ToBytes() []byte

ToBytes marshal redis.Reply

type SyntaxErrReply

type SyntaxErrReply struct{}

SyntaxErrReply represents meeting unexpected arguments

func MakeSyntaxErrReply

func MakeSyntaxErrReply() *SyntaxErrReply

MakeSyntaxErrReply creates syntax error

func (*SyntaxErrReply) Error

func (r *SyntaxErrReply) Error() string

func (*SyntaxErrReply) ToBytes

func (r *SyntaxErrReply) ToBytes() []byte

ToBytes marshals redis.Reply

type UnknownErrReply

type UnknownErrReply struct{}

UnknownErrReply represents UnknownErr

func (*UnknownErrReply) Error

func (r *UnknownErrReply) Error() string

func (*UnknownErrReply) ToBytes

func (r *UnknownErrReply) ToBytes() []byte

ToBytes marshals redis.Reply

type WrongTypeErrReply

type WrongTypeErrReply struct{}

WrongTypeErrReply represents operation against a key holding the wrong kind of value

func (*WrongTypeErrReply) Error

func (r *WrongTypeErrReply) Error() string

func (*WrongTypeErrReply) ToBytes

func (r *WrongTypeErrReply) ToBytes() []byte

ToBytes marshals redis.Reply

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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