1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Fix all examples in readme. Req now implements Stringer interface for debugging purposes.

This commit is contained in:
Vladimir Mihailenco
2013-02-17 18:49:17 +02:00
parent ed0d065f72
commit a07e186fb3
4 changed files with 232 additions and 61 deletions

12
req.go
View File

@ -1,7 +1,9 @@
package redis
import (
"fmt"
"strconv"
"strings"
)
type Req interface {
@ -64,6 +66,16 @@ func (r *BaseReq) ParseReply(rd reader) (interface{}, error) {
return parseReply(rd)
}
func (r *BaseReq) String() string {
args := strings.Join(r.args, " ")
if r.err != nil {
return args + ": " + r.err.Error()
} else if r.val != nil {
return args + ": " + fmt.Sprint(r.val)
}
return args
}
//------------------------------------------------------------------------------
type IfaceReq struct {