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

Add BITFIELD_RO Command (#2820)

Co-authored-by: Chayim <chayim@users.noreply.github.com>
This commit is contained in:
ofekshenawa
2023-12-17 15:19:27 +02:00
committed by GitHub
parent 277e8b7d9f
commit 1d784578df
2 changed files with 35 additions and 1 deletions

View File

@ -1279,6 +1279,20 @@ var _ = Describe("Commands", func() {
Expect(nn).To(Equal([]int64{0, 4}))
})
It("should BitFieldRO", func() {
nn, err := client.BitField(ctx, "mykey", "SET", "u8", 8, 255).Result()
Expect(err).NotTo(HaveOccurred())
Expect(nn).To(Equal([]int64{0}))
nn, err = client.BitFieldRO(ctx, "mykey", "u8", 0).Result()
Expect(err).NotTo(HaveOccurred())
Expect(nn).To(Equal([]int64{0}))
nn, err = client.BitFieldRO(ctx, "mykey", "u8", 0, "u4", 8, "u4", 12, "u4", 13).Result()
Expect(err).NotTo(HaveOccurred())
Expect(nn).To(Equal([]int64{0, 15, 15, 14}))
})
It("should Decr", func() {
set := client.Set(ctx, "key", "10", 0)
Expect(set.Err()).NotTo(HaveOccurred())