Skip to content

Commit 5d1d22c

Browse files
authored
Merge branch 'master' into universal
2 parents 6c8231f + 1505939 commit 5d1d22c

File tree

15 files changed

+292
-23
lines changed

15 files changed

+292
-23
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v4
2323
- name: golangci-lint
24-
uses: golangci/[email protected].1
24+
uses: golangci/[email protected].2

commands_test.go

Lines changed: 142 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2659,7 +2659,6 @@ var _ = Describe("Commands", func() {
26592659
Expect(res).To(Equal([]int64{1, 1, -2}))
26602660
})
26612661

2662-
26632662
It("should HPExpire", Label("hash-expiration", "NonRedisEnterprise"), func() {
26642663
SkipBeforeRedisVersion(7.4, "doesn't work with older redis stack images")
26652664
res, err := client.HPExpire(ctx, "no_such_key", 10*time.Second, "field1", "field2", "field3").Result()
@@ -2812,6 +2811,148 @@ var _ = Describe("Commands", func() {
28122811
Expect(err).NotTo(HaveOccurred())
28132812
Expect(res[0]).To(BeNumerically("~", 10*time.Second.Milliseconds(), 1))
28142813
})
2814+
2815+
It("should HGETDEL", Label("hash", "HGETDEL"), func() {
2816+
SkipBeforeRedisVersion(7.9, "requires Redis 8.x")
2817+
2818+
err := client.HSet(ctx, "myhash", "f1", "val1", "f2", "val2", "f3", "val3").Err()
2819+
Expect(err).NotTo(HaveOccurred())
2820+
2821+
// Execute HGETDEL on fields f1 and f2.
2822+
res, err := client.HGetDel(ctx, "myhash", "f1", "f2").Result()
2823+
Expect(err).NotTo(HaveOccurred())
2824+
// Expect the returned values for f1 and f2.
2825+
Expect(res).To(Equal([]string{"val1", "val2"}))
2826+
2827+
// Verify that f1 and f2 have been deleted, while f3 remains.
2828+
remaining, err := client.HMGet(ctx, "myhash", "f1", "f2", "f3").Result()
2829+
Expect(err).NotTo(HaveOccurred())
2830+
Expect(remaining[0]).To(BeNil())
2831+
Expect(remaining[1]).To(BeNil())
2832+
Expect(remaining[2]).To(Equal("val3"))
2833+
})
2834+
2835+
It("should return nil responses for HGETDEL on non-existent key", Label("hash", "HGETDEL"), func() {
2836+
SkipBeforeRedisVersion(7.9, "requires Redis 8.x")
2837+
// HGETDEL on a key that does not exist.
2838+
res, err := client.HGetDel(ctx, "nonexistent", "f1", "f2").Result()
2839+
Expect(err).To(BeNil())
2840+
Expect(res).To(Equal([]string{"", ""}))
2841+
})
2842+
2843+
// -----------------------------
2844+
// HGETEX with various TTL options
2845+
// -----------------------------
2846+
It("should HGETEX with EX option", Label("hash", "HGETEX"), func() {
2847+
SkipBeforeRedisVersion(7.9, "requires Redis 8.x")
2848+
2849+
err := client.HSet(ctx, "myhash", "f1", "val1", "f2", "val2").Err()
2850+
Expect(err).NotTo(HaveOccurred())
2851+
2852+
// Call HGETEX with EX option and 60 seconds TTL.
2853+
opt := redis.HGetEXOptions{
2854+
ExpirationType: redis.HGetEXExpirationEX,
2855+
ExpirationVal: 60,
2856+
}
2857+
res, err := client.HGetEXWithArgs(ctx, "myhash", &opt, "f1", "f2").Result()
2858+
Expect(err).NotTo(HaveOccurred())
2859+
Expect(res).To(Equal([]string{"val1", "val2"}))
2860+
})
2861+
2862+
It("should HGETEX with PERSIST option", Label("hash", "HGETEX"), func() {
2863+
SkipBeforeRedisVersion(7.9, "requires Redis 8.x")
2864+
2865+
err := client.HSet(ctx, "myhash", "f1", "val1", "f2", "val2").Err()
2866+
Expect(err).NotTo(HaveOccurred())
2867+
2868+
// Call HGETEX with PERSIST (no TTL value needed).
2869+
opt := redis.HGetEXOptions{ExpirationType: redis.HGetEXExpirationPERSIST}
2870+
res, err := client.HGetEXWithArgs(ctx, "myhash", &opt, "f1", "f2").Result()
2871+
Expect(err).NotTo(HaveOccurred())
2872+
Expect(res).To(Equal([]string{"val1", "val2"}))
2873+
})
2874+
2875+
It("should HGETEX with EXAT option", Label("hash", "HGETEX"), func() {
2876+
SkipBeforeRedisVersion(7.9, "requires Redis 8.x")
2877+
2878+
err := client.HSet(ctx, "myhash", "f1", "val1", "f2", "val2").Err()
2879+
Expect(err).NotTo(HaveOccurred())
2880+
2881+
// Set expiration at a specific Unix timestamp (60 seconds from now).
2882+
expireAt := time.Now().Add(60 * time.Second).Unix()
2883+
opt := redis.HGetEXOptions{
2884+
ExpirationType: redis.HGetEXExpirationEXAT,
2885+
ExpirationVal: expireAt,
2886+
}
2887+
res, err := client.HGetEXWithArgs(ctx, "myhash", &opt, "f1", "f2").Result()
2888+
Expect(err).NotTo(HaveOccurred())
2889+
Expect(res).To(Equal([]string{"val1", "val2"}))
2890+
})
2891+
2892+
// -----------------------------
2893+
// HSETEX with FNX/FXX options
2894+
// -----------------------------
2895+
It("should HSETEX with FNX condition", Label("hash", "HSETEX"), func() {
2896+
SkipBeforeRedisVersion(7.9, "requires Redis 8.x")
2897+
2898+
opt := redis.HSetEXOptions{
2899+
Condition: redis.HSetEXFNX,
2900+
ExpirationType: redis.HSetEXExpirationEX,
2901+
ExpirationVal: 60,
2902+
}
2903+
res, err := client.HSetEXWithArgs(ctx, "myhash", &opt, "f1", "val1").Result()
2904+
Expect(err).NotTo(HaveOccurred())
2905+
Expect(res).To(Equal(int64(1)))
2906+
2907+
opt = redis.HSetEXOptions{
2908+
Condition: redis.HSetEXFNX,
2909+
ExpirationType: redis.HSetEXExpirationEX,
2910+
ExpirationVal: 60,
2911+
}
2912+
res, err = client.HSetEXWithArgs(ctx, "myhash", &opt, "f1", "val2").Result()
2913+
Expect(err).NotTo(HaveOccurred())
2914+
Expect(res).To(Equal(int64(0)))
2915+
})
2916+
2917+
It("should HSETEX with FXX condition", Label("hash", "HSETEX"), func() {
2918+
SkipBeforeRedisVersion(7.9, "requires Redis 8.x")
2919+
2920+
err := client.HSet(ctx, "myhash", "f2", "val1").Err()
2921+
Expect(err).NotTo(HaveOccurred())
2922+
2923+
opt := redis.HSetEXOptions{
2924+
Condition: redis.HSetEXFXX,
2925+
ExpirationType: redis.HSetEXExpirationEX,
2926+
ExpirationVal: 60,
2927+
}
2928+
res, err := client.HSetEXWithArgs(ctx, "myhash", &opt, "f2", "val2").Result()
2929+
Expect(err).NotTo(HaveOccurred())
2930+
Expect(res).To(Equal(int64(1)))
2931+
opt = redis.HSetEXOptions{
2932+
Condition: redis.HSetEXFXX,
2933+
ExpirationType: redis.HSetEXExpirationEX,
2934+
ExpirationVal: 60,
2935+
}
2936+
res, err = client.HSetEXWithArgs(ctx, "myhash", &opt, "f3", "val3").Result()
2937+
Expect(err).NotTo(HaveOccurred())
2938+
Expect(res).To(Equal(int64(0)))
2939+
})
2940+
2941+
It("should HSETEX with multiple field operations", Label("hash", "HSETEX"), func() {
2942+
SkipBeforeRedisVersion(7.9, "requires Redis 8.x")
2943+
2944+
opt := redis.HSetEXOptions{
2945+
ExpirationType: redis.HSetEXExpirationEX,
2946+
ExpirationVal: 60,
2947+
}
2948+
res, err := client.HSetEXWithArgs(ctx, "myhash", &opt, "f1", "val1", "f2", "val2").Result()
2949+
Expect(err).NotTo(HaveOccurred())
2950+
Expect(res).To(Equal(int64(1)))
2951+
2952+
values, err := client.HMGet(ctx, "myhash", "f1", "f2").Result()
2953+
Expect(err).NotTo(HaveOccurred())
2954+
Expect(values).To(Equal([]interface{}{"val1", "val2"}))
2955+
})
28152956
})
28162957

28172958
Describe("hyperloglog", func() {

example/del-keys-without-ttl/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.18
55
replace github.com/redis/go-redis/v9 => ../..
66

77
require (
8-
github.com/redis/go-redis/v9 v9.7.1
8+
github.com/redis/go-redis/v9 v9.7.3
99
go.uber.org/zap v1.24.0
1010
)
1111

example/hll/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.18
44

55
replace github.com/redis/go-redis/v9 => ../..
66

7-
require github.com/redis/go-redis/v9 v9.7.1
7+
require github.com/redis/go-redis/v9 v9.7.3
88

99
require (
1010
github.com/cespare/xxhash/v2 v2.3.0 // indirect

example/lua-scripting/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.18
44

55
replace github.com/redis/go-redis/v9 => ../..
66

7-
require github.com/redis/go-redis/v9 v9.7.1
7+
require github.com/redis/go-redis/v9 v9.7.3
88

99
require (
1010
github.com/cespare/xxhash/v2 v2.3.0 // indirect

example/otel/go.mod

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module github.com/redis/go-redis/example/otel
22

3-
go 1.19
3+
go 1.23.0
4+
45
toolchain go1.24.1
56

67
replace github.com/redis/go-redis/v9 => ../..
@@ -10,8 +11,8 @@ replace github.com/redis/go-redis/extra/redisotel/v9 => ../../extra/redisotel
1011
replace github.com/redis/go-redis/extra/rediscmd/v9 => ../../extra/rediscmd
1112

1213
require (
13-
github.com/redis/go-redis/extra/redisotel/v9 v9.7.1
14-
github.com/redis/go-redis/v9 v9.7.1
14+
github.com/redis/go-redis/extra/redisotel/v9 v9.7.3
15+
github.com/redis/go-redis/v9 v9.7.3
1516
github.com/uptrace/uptrace-go v1.21.0
1617
go.opentelemetry.io/otel v1.22.0
1718
)
@@ -24,7 +25,7 @@ require (
2425
github.com/go-logr/stdr v1.2.2 // indirect
2526
github.com/golang/protobuf v1.5.3 // indirect
2627
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
27-
github.com/redis/go-redis/extra/rediscmd/v9 v9.7.1 // indirect
28+
github.com/redis/go-redis/extra/rediscmd/v9 v9.7.3 // indirect
2829
go.opentelemetry.io/contrib/instrumentation/runtime v0.46.1 // indirect
2930
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.44.0 // indirect
3031
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect

example/redis-bloom/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.18
44

55
replace github.com/redis/go-redis/v9 => ../..
66

7-
require github.com/redis/go-redis/v9 v9.7.1
7+
require github.com/redis/go-redis/v9 v9.7.3
88

99
require (
1010
github.com/cespare/xxhash/v2 v2.3.0 // indirect

example/scan-struct/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ replace github.com/redis/go-redis/v9 => ../..
66

77
require (
88
github.com/davecgh/go-spew v1.1.1
9-
github.com/redis/go-redis/v9 v9.7.1
9+
github.com/redis/go-redis/v9 v9.7.3
1010
)
1111

1212
require (

extra/rediscensus/go.mod

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ replace github.com/redis/go-redis/v9 => ../..
77
replace github.com/redis/go-redis/extra/rediscmd/v9 => ../rediscmd
88

99
require (
10-
github.com/redis/go-redis/extra/rediscmd/v9 v9.7.1
11-
github.com/redis/go-redis/v9 v9.7.1
10+
github.com/redis/go-redis/extra/rediscmd/v9 v9.7.3
11+
github.com/redis/go-redis/v9 v9.7.3
1212
go.opencensus.io v0.24.0
1313
)
1414

@@ -18,4 +18,7 @@ require (
1818
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
1919
)
2020

21-
retract v9.5.3 // This version was accidentally released.
21+
retract (
22+
v9.5.3 // This version was accidentally released.
23+
v9.7.2 // This version was accidentally released.
24+
)

extra/rediscmd/go.mod

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ replace github.com/redis/go-redis/v9 => ../..
77
require (
88
github.com/bsm/ginkgo/v2 v2.12.0
99
github.com/bsm/gomega v1.27.10
10-
github.com/redis/go-redis/v9 v9.7.1
10+
github.com/redis/go-redis/v9 v9.7.3
1111
)
1212

1313
require (
1414
github.com/cespare/xxhash/v2 v2.3.0 // indirect
1515
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
1616
)
1717

18-
retract v9.5.3 // This version was accidentally released.
18+
retract (
19+
v9.5.3 // This version was accidentally released.
20+
v9.7.2 // This version was accidentally released.
21+
)

0 commit comments

Comments
 (0)