Lines Matching refs:reply

35 func Int(reply interface{}, err error) (int, error) {
39 switch reply := reply.(type) {
41 x := int(reply)
42 if int64(x) != reply {
47 n, err := strconv.ParseInt(string(reply), 10, 0)
52 return 0, reply
54 return 0, fmt.Errorf("redigo: unexpected type for Int, got type %T", reply)
66 func Int64(reply interface{}, err error) (int64, error) {
70 switch reply := reply.(type) {
72 return reply, nil
74 n, err := strconv.ParseInt(string(reply), 10, 64)
79 return 0, reply
81 return 0, fmt.Errorf("redigo: unexpected type for Int64, got type %T", reply)
95 func Uint64(reply interface{}, err error) (uint64, error) {
99 switch reply := reply.(type) {
101 if reply < 0 {
104 return uint64(reply), nil
106 n, err := strconv.ParseUint(string(reply), 10, 64)
111 return 0, reply
113 return 0, fmt.Errorf("redigo: unexpected type for Uint64, got type %T", reply)
124 func Float64(reply interface{}, err error) (float64, error) {
128 switch reply := reply.(type) {
130 n, err := strconv.ParseFloat(string(reply), 64)
135 return 0, reply
137 return 0, fmt.Errorf("redigo: unexpected type for Float64, got type %T", reply)
149 func String(reply interface{}, err error) (string, error) {
153 switch reply := reply.(type) {
155 return string(reply), nil
157 return reply, nil
161 return "", reply
163 return "", fmt.Errorf("redigo: unexpected type for String, got type %T", reply)
175 func Bytes(reply interface{}, err error) ([]byte, error) {
179 switch reply := reply.(type) {
181 return reply, nil
183 return []byte(reply), nil
187 return nil, reply
189 return nil, fmt.Errorf("redigo: unexpected type for Bytes, got type %T", reply)
201 func Bool(reply interface{}, err error) (bool, error) {
205 switch reply := reply.(type) {
207 return reply != 0, nil
209 return strconv.ParseBool(string(reply))
213 return false, reply
215 return false, fmt.Errorf("redigo: unexpected type for Bool, got type %T", reply)
219 func MultiBulk(reply interface{}, err error) ([]interface{}, error) { return Values(reply, err) }
229 func Values(reply interface{}, err error) ([]interface{}, error) {
233 switch reply := reply.(type) {
235 return reply, nil
239 return nil, reply
241 return nil, fmt.Errorf("redigo: unexpected type for Values, got type %T", reply)
248 func Strings(reply interface{}, err error) ([]string, error) {
252 switch reply := reply.(type) {
254 result := make([]string, len(reply))
255 for i := range reply {
256 if reply[i] == nil {
259 p, ok := reply[i].([]byte)
261 return nil, fmt.Errorf("redigo: unexpected element type for Strings, got type %T", reply[i])
269 return nil, reply
271 return nil, fmt.Errorf("redigo: unexpected type for Strings, got type %T", reply)
276 func Ints(reply interface{}, err error) ([]int, error) {
278 if reply == nil {
281 values, err := Values(reply, err)