|
|
@ -172,3 +172,26 @@ func HExists(key string, field string, url ...string) (int64, error) { |
|
|
|
|
|
|
|
return res.GetRet(), nil |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func HIncrby(key, field string,value int64, url ...string) (int64, error) { |
|
|
|
|
|
|
|
conn, _, err := Conn(url...) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
defer conn.Close() |
|
|
|
|
|
|
|
req := &HSetRequest{proto.String(key), proto.String(field), proto.String(string(value)), nil} |
|
|
|
|
|
|
|
res := &HSetResponse{} |
|
|
|
|
|
|
|
err = conn.HIncrby(req, res) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
|
|
|
|
return res.GetRet(), nil |
|
|
|
} |