1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00

Use string val in StringCmd.

This commit is contained in:
Vladimir Mihailenco
2016-11-20 09:50:49 +02:00
parent c985686167
commit a20665f042
5 changed files with 36 additions and 44 deletions

View File

@ -11,7 +11,13 @@ import (
const bytesAllocLimit = 1024 * 1024 // 1mb
const errEmptyReply = internal.RedisError("redis: reply is empty")
const (
ErrorReply = '-'
StatusReply = '+'
IntReply = ':'
StringReply = '$'
ArrayReply = '*'
)
type MultiBulkParse func(*Reader, int64) (interface{}, error)
@ -23,7 +29,7 @@ type Reader struct {
func NewReader(rd io.Reader) *Reader {
return &Reader{
src: bufio.NewReader(rd),
buf: make([]byte, 0, defaultBufSize),
buf: make([]byte, 0, bufferSize),
}
}
@ -48,7 +54,7 @@ func (p *Reader) ReadLine() ([]byte, error) {
return nil, bufio.ErrBufferFull
}
if len(line) == 0 {
return nil, errEmptyReply
return nil, internal.RedisError("redis: reply is empty")
}
if isNilReply(line) {
return nil, internal.Nil