Documentation ¶
Index ¶
- Constants
- func IsNilReply(line []byte) bool
- func ParseErrorReply(line []byte) error
- func Scan(b []byte, v interface{}) error
- func ScanSlice(data []string, slice interface{}) error
- type Reader
- func (r *Reader) Buffered() int
- func (r *Reader) Discard(line []byte) (err error)
- func (r *Reader) DiscardNext() error
- func (r *Reader) Peek(n int) ([]byte, error)
- func (r *Reader) PeekReplyType() (byte, error)
- func (r *Reader) ReadArrayLen() (int, error)
- func (r *Reader) ReadBool() (bool, error)
- func (r *Reader) ReadFixedArrayLen(fixedLen int) error
- func (r *Reader) ReadFixedMapLen(fixedLen int) error
- func (r *Reader) ReadFloat() (float64, error)
- func (r *Reader) ReadInt() (int64, error)
- func (r *Reader) ReadLine() ([]byte, error)
- func (r *Reader) ReadMapLen() (int, error)
- func (r *Reader) ReadReply() (interface{}, error)
- func (r *Reader) ReadSlice() ([]interface{}, error)
- func (r *Reader) ReadString() (string, error)
- func (r *Reader) ReadUint() (uint64, error)
- func (r *Reader) Reset(rd io.Reader)
- type RedisError
- type Writer
Constants ¶
View Source
const ( RespStatus = '+' // +<string>\r\n RespError = '-' // -<string>\r\n RespString = '$' // $<length>\r\n<bytes>\r\n RespInt = ':' // :<number>\r\n RespNil = '_' // _\r\n RespFloat = ',' // ,<floating-point-number>\r\n (golang float) RespBool = '#' // true: #t\r\n false: #f\r\n RespBlobError = '!' // !<length>\r\n<bytes>\r\n RespVerbatim = '=' // =<length>\r\nFORMAT:<bytes>\r\n RespBigInt = '(' // (<big number>\r\n RespArray = '*' // *<len>\r\n... (same as resp2) RespMap = '%' // %<len>\r\n(key)\r\n(value)\r\n... (golang map) RespSet = '~' // ~<len>\r\n... (same as Array) RespAttr = '|' // |<len>\r\n(key)\r\n(value)\r\n... + command reply RespPush = '>' // ><len>\r\n... (same as Array) )
redis resp protocol data type.
View Source
const Nil = RedisError("redis: nil") // nolint:errname
Variables ¶
This section is empty.
Functions ¶
func ParseErrorReply ¶
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func (*Reader) DiscardNext ¶
DiscardNext read and discard the data represented by the next line.
func (*Reader) PeekReplyType ¶
PeekReplyType returns the data type of the next response without advancing the Reader, and discard the attribute type.
func (*Reader) ReadArrayLen ¶
ReadArrayLen Read and return the length of the array.
func (*Reader) ReadFixedArrayLen ¶
ReadFixedArrayLen read fixed array length.
func (*Reader) ReadFixedMapLen ¶
ReadFixedMapLen reads fixed map length.
func (*Reader) ReadLine ¶
ReadLine Return a valid reply, it will check the protocol or redis error, and discard the attribute type.
func (*Reader) ReadMapLen ¶
ReadMapLen reads the length of the map type. If responding to the array type (RespArray/RespSet/RespPush), it must be a multiple of 2 and return n/2. Other types will return an error.
func (*Reader) ReadString ¶
type RedisError ¶
type RedisError string
func (RedisError) Error ¶
func (e RedisError) Error() string
func (RedisError) RedisError ¶
func (RedisError) RedisError()
Click to show internal directories.
Click to hide internal directories.