redis / go-redis

Redis Go client
https://redis.uptrace.dev
BSD 2-Clause "Simplified" License
20.11k stars 2.37k forks source link

BitCount return ERR syntax error #2956

Closed ViolaPioggia closed 7 months ago

ViolaPioggia commented 7 months ago

I use go-redis with BitCount like this but return ERR syntax error

res, err := svc.Svc.Rdb.BitCount(ctx,
    fmt.Sprintf("%s%s",
    jwzxconsts.RdbKeyNewsRead,
    item.Id,
    ),
    &redis.BitCount{
            Start: 0,
        End:   -1,
    },
).Result()

Expected Behavior

return bitcount value normally

Current Behavior

return ERR syntax error

Possible Solution

My current go-redis version is v9.5.1(newest) , when I roll back to the v9.3.0 , this problem is soluted

redis v7.0.0 bitcount add a field 'Unit' , and In go-redis v9.5.1 it will add this field automically, but my redis version is below v7.0.0 so that it returned ERR syntax error

Context (Environment)

go version: 1.21.8 redis version: 6.2.8 go-redis version: 9.5.1

Detailed Description

I prefer you can ensure forward compatibility