Documentation ¶
Index ¶
- Variables
- type Array
- func (array *Array) Append(msg *Message)
- func (array *Array) Next() (*Message, error)
- func (array *Array) NextArray() (*Array, error)
- func (array *Array) NextBytes() ([]byte, error)
- func (array *Array) NextError() (error, error)
- func (array *Array) NextInteger() (int, error)
- func (array *Array) NextMessage() (*Message, error)
- func (array *Array) NextMessages() ([]*Message, error)
- func (array *Array) NextString() (string, error)
- func (array *Array) RESPBytes() ([]byte, error)
- func (array *Array) Reverse() *Array
- func (array *Array) ReverseBy(step int) *Array
- func (array *Array) Size() int
- type Message
- func (msg *Message) Append(arrayMsg *Message) error
- func (msg *Message) Array() (*Array, error)
- func (msg *Message) Bytes() ([]byte, error)
- func (msg *Message) Error() (error, error)
- func (msg *Message) Integer() (int, error)
- func (msg *Message) IsArray() bool
- func (msg *Message) IsBulk() bool
- func (msg *Message) IsError() bool
- func (msg *Message) IsInteger() bool
- func (msg *Message) IsNil() bool
- func (msg *Message) IsString() bool
- func (msg *Message) IsType(t MessageType) bool
- func (msg *Message) RESPBytes() ([]byte, error)
- func (msg *Message) SetArray(array *Array) *Message
- func (msg *Message) SetBytes(bytes []byte) *Message
- func (msg *Message) String() (string, error)
- type MessageType
- type Parser
Constants ¶
This section is empty.
Variables ¶
var ErrEOM = errors.New("EOM")
ErrEOM is the error returned by Array::Next() when no more message is available.
var ErrNil = errors.New("NIL")
ErrNil is the error returned by Message::String() when the bytes are nil.
Functions ¶
This section is empty.
Types ¶
type Array ¶
type Array struct {
// contains filtered or unexported fields
}
Array represents a array message.
func (*Array) NextArray ¶
NextArray returns the message array if the message type is array, otherwise it returns an error.
func (*Array) NextError ¶
NextError returns the message error if the message type is error, otherwise it returns an error.
func (*Array) NextInteger ¶
NextInteger returns the message integer if the message type is integer, otherwise it returns an error.
func (*Array) NextMessage ¶
NextMessage returns the next message if any, otherwise it returns error.
func (*Array) NextMessages ¶
NextMessages returns all unread messages.
func (*Array) NextString ¶
NextString returns the message string if the message type is string, otherwise it returns an error.
type Message ¶
type Message struct { Type MessageType // contains filtered or unexported fields }
Message represents a message of Redis serialization protocol.
func NewMessageWithType ¶
func NewMessageWithType(t MessageType) *Message
NewMessageWithType returns a new message instance with the specified type.
func (*Message) Array ¶
Array returns the message array if the message type is array, otherwise it returns an error.
func (*Message) Error ¶
Error returns the message error if the message type is error, otherwise it returns an error.
func (*Message) Integer ¶
Integer returns the message integer if the message type is integer, otherwise it returns an error.
func (*Message) IsNil ¶ added in v1.0.0
IsNil returns true if the message type is bulk and the message bytes are nil, otherwise false.
func (*Message) IsType ¶
func (msg *Message) IsType(t MessageType) bool
IsType returns true if the message type is the specified type, otherwise false.
type MessageType ¶
type MessageType int
MessageType represents a message type of Redis serialization protocol.
const ( StringMessage MessageType = iota ErrorMessage IntegerMessage BulkMessage ArrayMessage )
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Paser represents a Redis serialization protocol (RESP) parser.
func NewParserWithBytes ¶
NewParserWithBytes returns a new parser for the specified bytes.
func NewParserWithReader ¶
NewParserWithReader returns a new parser for the specified reader.