1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

feat(cmd): support for adding byte,bit parameters to the bitpos command (#2498)

Signed-off-by: monkey92t <golang@88.com>
This commit is contained in:
Monkey
2023-03-23 00:05:50 +08:00
committed by GitHub
parent 153a9efb96
commit 540554043b
2 changed files with 28 additions and 0 deletions

View File

@ -1091,6 +1091,19 @@ var _ = Describe("Commands", func() {
Expect(pos).To(Equal(int64(-1)))
})
It("should BitPosSpan", func() {
err := client.Set(ctx, "mykey", "\x00\xff\x00", 0).Err()
Expect(err).NotTo(HaveOccurred())
pos, err := client.BitPosSpan(ctx, "mykey", 0, 1, 3, "byte").Result()
Expect(err).NotTo(HaveOccurred())
Expect(pos).To(Equal(int64(16)))
pos, err = client.BitPosSpan(ctx, "mykey", 0, 1, 3, "bit").Result()
Expect(err).NotTo(HaveOccurred())
Expect(pos).To(Equal(int64(1)))
})
It("should BitField", func() {
nn, err := client.BitField(ctx, "mykey", "INCRBY", "i5", 100, 1, "GET", "u4", 0).Result()
Expect(err).NotTo(HaveOccurred())