mirror of https://github.com/go-redis/redis.git
Merge pull request #1680 from lhchavez/add-setargs-to-pipeliner
Make SetArgs available to Pipeliner
This commit is contained in:
commit
097b94a797
|
@ -124,6 +124,7 @@ type Cmdable interface {
|
||||||
MSet(ctx context.Context, values ...interface{}) *StatusCmd
|
MSet(ctx context.Context, values ...interface{}) *StatusCmd
|
||||||
MSetNX(ctx context.Context, values ...interface{}) *BoolCmd
|
MSetNX(ctx context.Context, values ...interface{}) *BoolCmd
|
||||||
Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd
|
Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd
|
||||||
|
SetArgs(ctx context.Context, key string, value interface{}, a SetArgs) *StatusCmd
|
||||||
SetEX(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd
|
SetEX(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd
|
||||||
SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd
|
SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd
|
||||||
SetXX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd
|
SetXX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd
|
||||||
|
|
|
@ -1400,6 +1400,23 @@ var _ = Describe("Commands", func() {
|
||||||
Expect(val).To(Equal("hello"))
|
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() {
|
It("should Set with expiration", func() {
|
||||||
err := client.Set(ctx, "key", "hello", 100*time.Millisecond).Err()
|
err := client.Set(ctx, "key", "hello", 100*time.Millisecond).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
Loading…
Reference in New Issue