mediocregopher / radix.v2

Redis client for Go
http://godoc.org/github.com/mediocregopher/radix.v2
MIT License
433 stars 92 forks source link

Check for nil? #6

Closed danqing closed 9 years ago

danqing commented 9 years ago

Correct me if I'm missing something, but I don't see a way to check if, for example, a GET returns nil?

r := client.Cmd("GET", "key")
if r.IsType(redis.Nil) // This won't work since Nil = 7 and IsType is bitwise &

Thanks!

mediocregopher commented 9 years ago

I'm sorry it's taken so long to respond, for some reason github decided I shouldn't receive notifications for issues on the repo >_<

The definition for that set of constants is 1 << iota, which means Nil's value is 1 << 7, or 128. So your check is correct.