@@ -5,7 +5,6 @@ package example_commands_test
5
5
import (
6
6
"context"
7
7
"fmt"
8
- "maps"
9
8
"slices"
10
9
11
10
"github.com/redis/go-redis/v9"
@@ -76,12 +75,16 @@ func ExampleClient_hset() {
76
75
panic (err )
77
76
}
78
77
79
- keys := slices .Collect (maps .Keys (res6 ))
78
+ keys := make ([]string , 0 , len (res6 ))
79
+
80
+ for key , _ := range res6 {
81
+ keys = append (keys , key )
82
+ }
80
83
81
84
slices .Sort (keys )
82
85
83
- for key , value := range res6 {
84
- fmt .Printf ("Key: %v, value: %v\n " , key , value )
86
+ for key , _ := range res6 {
87
+ fmt .Printf ("Key: %v, value: %v\n " , key , res6 [ key ] )
85
88
}
86
89
// >>> Key: field1, value: Hello
87
90
// >>> Key: field2, value: Hi
@@ -175,12 +178,16 @@ func ExampleClient_hgetall() {
175
178
panic (err )
176
179
}
177
180
178
- keys := slices .Collect (maps .Keys (hGetAllResult2 ))
181
+ keys := make ([]string , 0 , len (hGetAllResult2 ))
182
+
183
+ for key , _ := range hGetAllResult2 {
184
+ keys = append (keys , key )
185
+ }
179
186
180
187
slices .Sort (keys )
181
188
182
- for key , value := range hGetAllResult2 {
183
- fmt .Printf ("Key: %v, value: %v\n " , key , value )
189
+ for key , _ := range hGetAllResult2 {
190
+ fmt .Printf ("Key: %v, value: %v\n " , key , hGetAllResult2 [ key ] )
184
191
}
185
192
// >>> Key: field1, value: Hello
186
193
// >>> Key: field2, value: World
0 commit comments