diff --git a/hash.go b/hash.go index 3400ca0..ac3a2fe 100644 --- a/hash.go +++ b/hash.go @@ -3,6 +3,7 @@ package redisrpc import ( "encoding/json" "log" + "strconv" "github.com/golang/protobuf/proto" ) @@ -174,7 +175,7 @@ func HExists(key string, field string, url ...string) (int64, error) { } -func HIncrby(key, field string,value int64, url ...string) (int64, error) { +func HIncrby(key, field string,value int, url ...string) (int64, error) { conn, _, err := Conn(url...) @@ -183,7 +184,7 @@ func HIncrby(key, field string,value int64, url ...string) (int64, error) { } defer conn.Close() - req := &HSetRequest{proto.String(key), proto.String(field), proto.String(string(value)), nil} + req := &HSetRequest{proto.String(key), proto.String(field), proto.String(strconv.Itoa(value)), nil} res := &HSetResponse{} diff --git a/hash_test.go b/hash_test.go index ba96dfb..38f2f78 100644 --- a/hash_test.go +++ b/hash_test.go @@ -57,7 +57,7 @@ func Test_HSet(t *testing.T) { func Test_Incrby(t *testing.T){ - res,err := HIncrby("test_incr","26_26","1") + res,err := HIncrby("test_incr","26_26",2) if err != nil { log.Println(err.Error())