gomodule / redigo

Go client for Redis
Apache License 2.0
9.76k stars 1.25k forks source link

HSET command is having issue with the return type (reply return variable) : unexpected type for String, got type int64 #633

Closed LokeshReddy63 closed 2 years ago

LokeshReddy63 commented 2 years ago

Ask questions at https://stackoverflow.com/questions/ask?tags=go+redis

if _, err := redis.String(conn.Do("HSET", redis.Args{}.Add("testkey:1").AddFlat(newUser)...)); err != nil {
        log.Panic(err)
    }
    values, err := redis.Values(conn.Do("HGETALL", "testkey:1"))

error that redigo is giving me

redigo: unexpected type for String, got type int64

I tried running the same command from cli and I see that its returning int64 , but redigo isn't expecting that. instead its expecting a string. basically HMSET returns string but this is deprecated , so i think we might need to use HSET instead of HMSET.

let me know if anyone need much information !!

LokeshReddy63 commented 2 years ago

please close , my bad , I have to use redis.Int64 instead of redis.String in the above code snippet.

Sorry !