@@ -1085,25 +1085,14 @@ var _ = Describe("Commands", func() {
1085
1085
})
1086
1086
1087
1087
It ("should HGetAll" , func () {
1088
- hSet := client .HSet ("hash" , "key1" , "hello1" )
1089
- Expect (hSet .Err ()).NotTo (HaveOccurred ())
1090
- hSet = client .HSet ("hash" , "key2" , "hello2" )
1091
- Expect (hSet .Err ()).NotTo (HaveOccurred ())
1092
-
1093
- hGetAll := client .HGetAll ("hash" )
1094
- Expect (hGetAll .Err ()).NotTo (HaveOccurred ())
1095
- Expect (hGetAll .Val ()).To (Equal ([]string {"key1" , "hello1" , "key2" , "hello2" }))
1096
- })
1097
-
1098
- It ("should HGetAllMap" , func () {
1099
- hSet := client .HSet ("hash" , "key1" , "hello1" )
1100
- Expect (hSet .Err ()).NotTo (HaveOccurred ())
1101
- hSet = client .HSet ("hash" , "key2" , "hello2" )
1102
- Expect (hSet .Err ()).NotTo (HaveOccurred ())
1088
+ err := client .HSet ("hash" , "key1" , "hello1" ).Err ()
1089
+ Expect (err ).NotTo (HaveOccurred ())
1090
+ err = client .HSet ("hash" , "key2" , "hello2" ).Err ()
1091
+ Expect (err ).NotTo (HaveOccurred ())
1103
1092
1104
- hGetAll := client .HGetAllMap ("hash" )
1105
- Expect (hGetAll . Err () ).NotTo (HaveOccurred ())
1106
- Expect (hGetAll . Val () ).To (Equal (map [string ]string {"key1" : "hello1" , "key2" : "hello2" }))
1093
+ m , err := client .HGetAll ("hash" ). Result ( )
1094
+ Expect (err ).NotTo (HaveOccurred ())
1095
+ Expect (m ).To (Equal (map [string ]string {"key1" : "hello1" , "key2" : "hello2" }))
1107
1096
})
1108
1097
1109
1098
It ("should HIncrBy" , func () {
@@ -1168,28 +1157,31 @@ var _ = Describe("Commands", func() {
1168
1157
})
1169
1158
1170
1159
It ("should HMGet" , func () {
1171
- hSet := client .HSet ("hash" , "key1" , "hello1" )
1172
- Expect (hSet . Err () ).NotTo (HaveOccurred ())
1173
- hSet = client .HSet ("hash" , "key2" , "hello2" )
1174
- Expect (hSet . Err () ).NotTo (HaveOccurred ())
1160
+ err := client .HSet ("hash" , "key1" , "hello1" ). Err ( )
1161
+ Expect (err ).NotTo (HaveOccurred ())
1162
+ err = client .HSet ("hash" , "key2" , "hello2" ). Err ( )
1163
+ Expect (err ).NotTo (HaveOccurred ())
1175
1164
1176
- hMGet := client .HMGet ("hash" , "key1" , "key2" , "_" )
1177
- Expect (hMGet . Err () ).NotTo (HaveOccurred ())
1178
- Expect (hMGet . Val () ).To (Equal ([]interface {}{"hello1" , "hello2" , nil }))
1165
+ vals , err := client .HMGet ("hash" , "key1" , "key2" , "_" ). Result ( )
1166
+ Expect (err ).NotTo (HaveOccurred ())
1167
+ Expect (vals ).To (Equal ([]interface {}{"hello1" , "hello2" , nil }))
1179
1168
})
1180
1169
1181
1170
It ("should HMSet" , func () {
1182
- hMSet := client .HMSet ("hash" , "key1" , "hello1" , "key2" , "hello2" )
1183
- Expect (hMSet .Err ()).NotTo (HaveOccurred ())
1184
- Expect (hMSet .Val ()).To (Equal ("OK" ))
1171
+ ok , err := client .HMSet ("hash" , map [string ]string {
1172
+ "key1" : "hello1" ,
1173
+ "key2" : "hello2" ,
1174
+ }).Result ()
1175
+ Expect (err ).NotTo (HaveOccurred ())
1176
+ Expect (ok ).To (Equal ("OK" ))
1185
1177
1186
- hGet := client .HGet ("hash" , "key1" )
1187
- Expect (hGet . Err () ).NotTo (HaveOccurred ())
1188
- Expect (hGet . Val () ).To (Equal ("hello1" ))
1178
+ v , err := client .HGet ("hash" , "key1" ). Result ( )
1179
+ Expect (err ).NotTo (HaveOccurred ())
1180
+ Expect (v ).To (Equal ("hello1" ))
1189
1181
1190
- hGet = client .HGet ("hash" , "key2" )
1191
- Expect (hGet . Err () ).NotTo (HaveOccurred ())
1192
- Expect (hGet . Val () ).To (Equal ("hello2" ))
1182
+ v , err = client .HGet ("hash" , "key2" ). Result ( )
1183
+ Expect (err ).NotTo (HaveOccurred ())
1184
+ Expect (v ).To (Equal ("hello2" ))
1193
1185
})
1194
1186
1195
1187
It ("should HSet" , func () {
0 commit comments