1
0
mirror of https://github.com/redis/go-redis.git synced 2025-06-15 12:41:41 +03:00

Add bitpos command.

This commit is contained in:
Vladimir Mihailenco
2014-10-07 13:54:43 +03:00
parent 4fefa47d6d
commit 754c11ab7f
2 changed files with 57 additions and 0 deletions

View File

@ -361,6 +361,22 @@ func (c *commandable) BitOpNot(destKey string, key string) *IntCmd {
return c.bitOp("NOT", destKey, key)
}
func (c *commandable) BitPos(key string, bit int64, pos ...int64) *IntCmd {
args := []string{"BITPOS", key, formatInt(bit)}
switch len(pos) {
case 0:
case 1:
args = append(args, formatInt(pos[0]))
case 2:
args = append(args, formatInt(pos[0]), formatInt(pos[1]))
default:
panic("too many arguments")
}
cmd := NewIntCmd(args...)
c.Process(cmd)
return cmd
}
func (c *commandable) Decr(key string) *IntCmd {
cmd := NewIntCmd("DECR", key)
c.Process(cmd)