func String(reply interface{}, err error) (string, error) {
    if err != nil {
	return "", err
    }
    switch reply := reply.(type) {
    case []byte:
	return string(reply), nil
    case string:
	return reply, nil
    case nil:
	return "", ErrNil
    case redisError:
	return "", reply
    }
    return "", fmt.Errorf("unexpected type %T for String", reply)
}
String is a helper that converts a command reply to a string. If err is not
equal to nil, then String returns "", err. Otherwise String converts the
reply to a string as follows:

Reply type      Result
bulk string     string(reply), nil
simple string   reply, nil
nil             "",  ErrNil
other           "",  error
package redis
import (
	"fmt"
	"errors"
	"strconv"
	"reflect"
)
var ErrNil = errors.New("nil reply")
func Int(reply interface{}, err error) (int, error) {
    if err != nil {
	return 0, err
    }
    switch reply := reply.(type) {
    case int64:
	x := int(reply)
	if int64(x) != reply {
	    return 0, strconv.ErrRange
	}
	return x, nil
    case []byte:
	n, err := strconv.ParseInt(string(reply), 10, 0)
	return int(n), err
    case nil:
	return 0, ErrNil
    case redisError:
	return 0, reply
    }
    return 0, fmt.Errorf("unexpected type %T for Int", reply)
}
func Int64(reply interface{}, err error) (int64, error) {
    if err != nil {
	return 0, err
    }
    switch reply := reply.(type) {
    case int64:
	return reply, nil
    case []byte:
	n, err := strconv.ParseInt(string(reply), 10, 64)
	return n, err
    case nil:
	return 0, ErrNil
    case redisError:
	return 0, reply
    }
    return 0, fmt.Errorf("unexpected type %T for Int64", reply)
}
func Float64(reply interface{}, err error) (float64, error) {
    if err != nil {
	return 0, err
    }
    switch reply := reply.(type) {
    case []byte:
	n, err := strconv.ParseFloat(string(reply), 64)
	return n, err
    case nil:
	return 0, ErrNil
    case redisError:
	return 0, reply
    }
    return 0, fmt.Errorf("unexpected type %T for Float64", reply)
}