mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Make SetArgs available to Pipeliner
SetArgs is amazing! It would be even more amazing to be able to use it within a non-transactional Pipeline.
This commit is contained in:
@ -1400,6 +1400,23 @@ var _ = Describe("Commands", func() {
|
||||
Expect(val).To(Equal("hello"))
|
||||
})
|
||||
|
||||
It("should Pipelined SetArgs with Get and key exists", func() {
|
||||
e := client.Set(ctx, "key", "hello", 0)
|
||||
Expect(e.Err()).NotTo(HaveOccurred())
|
||||
|
||||
args := redis.SetArgs{
|
||||
Get: true,
|
||||
}
|
||||
|
||||
pipe := client.Pipeline()
|
||||
setArgs := pipe.SetArgs(ctx, "key", "world", args)
|
||||
_, err := pipe.Exec(ctx)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(setArgs.Err()).NotTo(HaveOccurred())
|
||||
Expect(setArgs.Val()).To(Equal("hello"))
|
||||
})
|
||||
|
||||
It("should Set with expiration", func() {
|
||||
err := client.Set(ctx, "key", "hello", 100*time.Millisecond).Err()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
Reference in New Issue
Block a user