@@ -280,7 +280,7 @@ func TestSingleClient(t *testing.T) {
280
280
if ! reflect .DeepEqual (cmd .Commands (), c .Commands ()) {
281
281
t .Fatalf ("unexpected command %v" , cmd )
282
282
}
283
- return newResult (RedisMessage { typ : '+' , string : "Do" } , nil )
283
+ return newResult (strmsg ( '+' , "Do" ) , nil )
284
284
}
285
285
if v , err := client .Do (context .Background (), c ).ToString (); err != nil || v != "Do" {
286
286
t .Fatalf ("unexpected response %v %v" , v , err )
@@ -303,7 +303,7 @@ func TestSingleClient(t *testing.T) {
303
303
if ! reflect .DeepEqual (cmd [0 ].Commands (), c .Commands ()) {
304
304
t .Fatalf ("unexpected command %v" , cmd )
305
305
}
306
- return & redisresults {s : []RedisResult {newResult (RedisMessage { typ : '+' , string : "Do" } , nil )}}
306
+ return & redisresults {s : []RedisResult {newResult (strmsg ( '+' , "Do" ) , nil )}}
307
307
}
308
308
if len (client .DoMulti (context .Background ())) != 0 {
309
309
t .Fatalf ("unexpected response length" )
@@ -332,7 +332,7 @@ func TestSingleClient(t *testing.T) {
332
332
if ! reflect .DeepEqual (cmd .Commands (), c .Commands ()) || ttl != 100 {
333
333
t .Fatalf ("unexpected command %v, %v" , cmd , ttl )
334
334
}
335
- return newResult (RedisMessage { typ : '+' , string : "DoCache" } , nil )
335
+ return newResult (strmsg ( '+' , "DoCache" ) , nil )
336
336
}
337
337
if v , err := client .DoCache (context .Background (), c , 100 ).ToString (); err != nil || v != "DoCache" {
338
338
t .Fatalf ("unexpected response %v %v" , v , err )
@@ -345,7 +345,7 @@ func TestSingleClient(t *testing.T) {
345
345
if ! reflect .DeepEqual (multi [0 ].Cmd .Commands (), c .Commands ()) || multi [0 ].TTL != 100 {
346
346
t .Fatalf ("unexpected command %v, %v" , multi [0 ].Cmd , multi [0 ].TTL )
347
347
}
348
- return & redisresults {s : []RedisResult {newResult (RedisMessage { typ : '+' , string : "DoCache" } , nil )}}
348
+ return & redisresults {s : []RedisResult {newResult (strmsg ( '+' , "DoCache" ) , nil )}}
349
349
}
350
350
if len (client .DoMultiCache (context .Background ())) != 0 {
351
351
t .Fatalf ("unexpected response length" )
@@ -419,10 +419,10 @@ func TestSingleClient(t *testing.T) {
419
419
closed := false
420
420
w := & mockWire {
421
421
DoFn : func (cmd Completed ) RedisResult {
422
- return newResult (RedisMessage { typ : '+' , string : "Delegate" } , nil )
422
+ return newResult (strmsg ( '+' , "Delegate" ) , nil )
423
423
},
424
424
DoMultiFn : func (cmd ... Completed ) * redisresults {
425
- return & redisresults {s : []RedisResult {newResult (RedisMessage { typ : '+' , string : "Delegate" } , nil )}}
425
+ return & redisresults {s : []RedisResult {newResult (strmsg ( '+' , "Delegate" ) , nil )}}
426
426
},
427
427
ReceiveFn : func (ctx context.Context , subscribe Completed , fn func (message PubSubMessage )) error {
428
428
return ErrClosing
@@ -485,10 +485,10 @@ func TestSingleClient(t *testing.T) {
485
485
closed := false
486
486
w := & mockWire {
487
487
DoFn : func (cmd Completed ) RedisResult {
488
- return newResult (RedisMessage { typ : '+' , string : "Delegate" } , nil )
488
+ return newResult (strmsg ( '+' , "Delegate" ) , nil )
489
489
},
490
490
DoMultiFn : func (cmd ... Completed ) * redisresults {
491
- return & redisresults {s : []RedisResult {newResult (RedisMessage { typ : '+' , string : "Delegate" } , nil )}}
491
+ return & redisresults {s : []RedisResult {newResult (strmsg ( '+' , "Delegate" ) , nil )}}
492
492
},
493
493
ReceiveFn : func (ctx context.Context , subscribe Completed , fn func (message PubSubMessage )) error {
494
494
return ErrClosing
@@ -688,7 +688,7 @@ func SetupClientRetry(t *testing.T, fn func(mock *mockConn) Client) {
688
688
c , m := setup ()
689
689
m .DoFn = makeDoFn (
690
690
newErrResult (ErrClosing ),
691
- newResult (RedisMessage { typ : '+' , string : "Do" } , nil ),
691
+ newResult (strmsg ( '+' , "Do" ) , nil ),
692
692
)
693
693
if v , err := c .Do (context .Background (), c .B ().Get ().Key ("Do" ).Build ()).ToString (); err != nil || v != "Do" {
694
694
t .Fatalf ("unexpected response %v %v" , v , err )
@@ -739,7 +739,7 @@ func SetupClientRetry(t *testing.T, fn func(mock *mockConn) Client) {
739
739
}
740
740
m .DoFn = makeDoFn (
741
741
newErrResult (ErrClosing ),
742
- newResult (RedisMessage { typ : '+' , string : "Do" } , nil ),
742
+ newResult (strmsg ( '+' , "Do" ) , nil ),
743
743
)
744
744
if v , err := c .Do (context .Background (), c .B ().Get ().Key ("Do" ).Build ()).ToString (); ! errors .Is (err , ErrClosing ) {
745
745
t .Fatalf ("unexpected response %v %v" , v , err )
@@ -758,7 +758,7 @@ func SetupClientRetry(t *testing.T, fn func(mock *mockConn) Client) {
758
758
c , m := setup ()
759
759
m .DoMultiFn = makeDoMultiFn (
760
760
[]RedisResult {newErrResult (ErrClosing )},
761
- []RedisResult {newResult (RedisMessage { typ : '+' , string : "Do" } , nil )},
761
+ []RedisResult {newResult (strmsg ( '+' , "Do" ) , nil )},
762
762
)
763
763
if v , err := c .DoMulti (context .Background (), c .B ().Get ().Key ("Do" ).Build ())[0 ].ToString (); err != nil || v != "Do" {
764
764
t .Fatalf ("unexpected response %v %v" , v , err )
@@ -817,7 +817,7 @@ func SetupClientRetry(t *testing.T, fn func(mock *mockConn) Client) {
817
817
}
818
818
m .DoMultiFn = makeDoMultiFn (
819
819
[]RedisResult {newErrResult (ErrClosing )},
820
- []RedisResult {newResult (RedisMessage { typ : '+' , string : "Do" } , nil )},
820
+ []RedisResult {newResult (strmsg ( '+' , "Do" ) , nil )},
821
821
)
822
822
if v , err := c .DoMulti (context .Background (), c .B ().Get ().Key ("Do" ).Build ())[0 ].ToString (); ! errors .Is (err , ErrClosing ) {
823
823
t .Fatalf ("unexpected response %v %v" , v , err )
@@ -836,7 +836,7 @@ func SetupClientRetry(t *testing.T, fn func(mock *mockConn) Client) {
836
836
c , m := setup ()
837
837
m .DoCacheFn = makeDoCacheFn (
838
838
newErrResult (ErrClosing ),
839
- newResult (RedisMessage { typ : '+' , string : "Do" } , nil ),
839
+ newResult (strmsg ( '+' , "Do" ) , nil ),
840
840
)
841
841
if v , err := c .DoCache (context .Background (), c .B ().Get ().Key ("Do" ).Cache (), 0 ).ToString (); err != nil || v != "Do" {
842
842
t .Fatalf ("unexpected response %v %v" , v , err )
@@ -887,7 +887,7 @@ func SetupClientRetry(t *testing.T, fn func(mock *mockConn) Client) {
887
887
}
888
888
m .DoCacheFn = makeDoCacheFn (
889
889
newErrResult (ErrClosing ),
890
- newResult (RedisMessage { typ : '+' , string : "Do" } , nil ),
890
+ newResult (strmsg ( '+' , "Do" ) , nil ),
891
891
)
892
892
if v , err := c .DoCache (context .Background (), c .B ().Get ().Key ("Do" ).Cache (), 0 ).ToString (); ! errors .Is (err , ErrClosing ) {
893
893
t .Fatalf ("unexpected response %v %v" , v , err )
@@ -898,7 +898,7 @@ func SetupClientRetry(t *testing.T, fn func(mock *mockConn) Client) {
898
898
c , m := setup ()
899
899
m .DoMultiCacheFn = makeDoMultiCacheFn (
900
900
[]RedisResult {newErrResult (ErrClosing )},
901
- []RedisResult {newResult (RedisMessage { typ : '+' , string : "Do" } , nil )},
901
+ []RedisResult {newResult (strmsg ( '+' , "Do" ) , nil )},
902
902
)
903
903
if v , err := c .DoMultiCache (context .Background (), CT (c .B ().Get ().Key ("Do" ).Cache (), 0 ))[0 ].ToString (); err != nil || v != "Do" {
904
904
t .Fatalf ("unexpected response %v %v" , v , err )
@@ -957,7 +957,7 @@ func SetupClientRetry(t *testing.T, fn func(mock *mockConn) Client) {
957
957
}
958
958
m .DoMultiCacheFn = makeDoMultiCacheFn (
959
959
[]RedisResult {newErrResult (ErrClosing )},
960
- []RedisResult {newResult (RedisMessage { typ : '+' , string : "Do" } , nil )},
960
+ []RedisResult {newResult (strmsg ( '+' , "Do" ) , nil )},
961
961
)
962
962
if v , err := c .DoMultiCache (context .Background (), CT (c .B ().Get ().Key ("Do" ).Cache (), 0 ))[0 ].ToString (); ! errors .Is (err , ErrClosing ) {
963
963
t .Fatalf ("unexpected response %v %v" , v , err )
@@ -1024,7 +1024,7 @@ func SetupClientRetry(t *testing.T, fn func(mock *mockConn) Client) {
1024
1024
c , m := setup ()
1025
1025
m .DoFn = makeDoFn (
1026
1026
newErrResult (ErrClosing ),
1027
- newResult (RedisMessage { typ : '+' , string : "Do" } , nil ),
1027
+ newResult (strmsg ( '+' , "Do" ) , nil ),
1028
1028
)
1029
1029
m .AcquireFn = func () wire { return & mockWire {DoFn : m .DoFn } }
1030
1030
if ret := c .Dedicated (func (cc DedicatedClient ) error {
@@ -1066,7 +1066,7 @@ func SetupClientRetry(t *testing.T, fn func(mock *mockConn) Client) {
1066
1066
c , m := setup ()
1067
1067
m .DoFn = makeDoFn (
1068
1068
newErrResult (ErrClosing ),
1069
- newResult (RedisMessage { typ : '+' , string : "Do" } , nil ),
1069
+ newResult (strmsg ( '+' , "Do" ) , nil ),
1070
1070
)
1071
1071
m .AcquireFn = func () wire { return & mockWire {DoFn : m .DoFn } }
1072
1072
if ret := c .Dedicated (func (cc DedicatedClient ) error {
@@ -1109,7 +1109,7 @@ func SetupClientRetry(t *testing.T, fn func(mock *mockConn) Client) {
1109
1109
c , m := setup ()
1110
1110
m .DoMultiFn = makeDoMultiFn (
1111
1111
[]RedisResult {newErrResult (ErrClosing )},
1112
- []RedisResult {newResult (RedisMessage { typ : '+' , string : "Do" } , nil )},
1112
+ []RedisResult {newResult (strmsg ( '+' , "Do" ) , nil )},
1113
1113
)
1114
1114
m .AcquireFn = func () wire { return & mockWire {DoMultiFn : m .DoMultiFn } }
1115
1115
if ret := c .Dedicated (func (cc DedicatedClient ) error {
@@ -1151,7 +1151,7 @@ func SetupClientRetry(t *testing.T, fn func(mock *mockConn) Client) {
1151
1151
c , m := setup ()
1152
1152
m .DoMultiFn = makeDoMultiFn (
1153
1153
[]RedisResult {newErrResult (ErrClosing )},
1154
- []RedisResult {newResult (RedisMessage { typ : '+' , string : "Do" } , nil )},
1154
+ []RedisResult {newResult (strmsg ( '+' , "Do" ) , nil )},
1155
1155
)
1156
1156
m .AcquireFn = func () wire { return & mockWire {DoMultiFn : m .DoMultiFn } }
1157
1157
if ret := c .Dedicated (func (cc DedicatedClient ) error {
@@ -1282,9 +1282,9 @@ func TestSingleClientLoadingRetry(t *testing.T) {
1282
1282
m .DoFn = func (cmd Completed ) RedisResult {
1283
1283
attempts ++
1284
1284
if attempts == 1 {
1285
- return newResult (RedisMessage { typ : '-' , string : "LOADING Redis is loading the dataset in memory" } , nil )
1285
+ return newResult (strmsg ( '-' , "LOADING Redis is loading the dataset in memory" ) , nil )
1286
1286
}
1287
- return newResult (RedisMessage { typ : '+' , string : "OK" } , nil )
1287
+ return newResult (strmsg ( '+' , "OK" ) , nil )
1288
1288
}
1289
1289
1290
1290
if v , err := client .Do (context .Background (), client .B ().Get ().Key ("test" ).Build ()).ToString (); err != nil || v != "OK" {
@@ -1301,9 +1301,9 @@ func TestSingleClientLoadingRetry(t *testing.T) {
1301
1301
m .DoFn = func (cmd Completed ) RedisResult {
1302
1302
attempts ++
1303
1303
if attempts == 1 {
1304
- return newResult (RedisMessage { typ : '-' , string : "ERR some other error" } , nil )
1304
+ return newResult (strmsg ( '-' , "ERR some other error" ) , nil )
1305
1305
}
1306
- return newResult (RedisMessage { typ : '+' , string : "OK" } , nil )
1306
+ return newResult (strmsg ( '+' , "OK" ) , nil )
1307
1307
}
1308
1308
1309
1309
if err := client .Do (context .Background (), client .B ().Get ().Key ("test" ).Build ()).Error (); err == nil {
@@ -1320,9 +1320,9 @@ func TestSingleClientLoadingRetry(t *testing.T) {
1320
1320
m .DoMultiFn = func (multi ... Completed ) * redisresults {
1321
1321
attempts ++
1322
1322
if attempts == 1 {
1323
- return & redisresults {s : []RedisResult {newResult (RedisMessage { typ : '-' , string : "LOADING Redis is loading the dataset in memory" } , nil )}}
1323
+ return & redisresults {s : []RedisResult {newResult (strmsg ( '-' , "LOADING Redis is loading the dataset in memory" ) , nil )}}
1324
1324
}
1325
- return & redisresults {s : []RedisResult {newResult (RedisMessage { typ : '+' , string : "OK" } , nil )}}
1325
+ return & redisresults {s : []RedisResult {newResult (strmsg ( '+' , "OK" ) , nil )}}
1326
1326
}
1327
1327
1328
1328
cmd := client .B ().Get ().Key ("test" ).Build ()
@@ -1341,9 +1341,9 @@ func TestSingleClientLoadingRetry(t *testing.T) {
1341
1341
m .DoCacheFn = func (cmd Cacheable , ttl time.Duration ) RedisResult {
1342
1342
attempts ++
1343
1343
if attempts == 1 {
1344
- return newResult (RedisMessage { typ : '-' , string : "LOADING Redis is loading the dataset in memory" } , nil )
1344
+ return newResult (strmsg ( '-' , "LOADING Redis is loading the dataset in memory" ) , nil )
1345
1345
}
1346
- return newResult (RedisMessage { typ : '+' , string : "OK" } , nil )
1346
+ return newResult (strmsg ( '+' , "OK" ) , nil )
1347
1347
}
1348
1348
1349
1349
cmd := client .B ().Get ().Key ("test" ).Cache ()
@@ -1358,9 +1358,9 @@ func TestSingleClientLoadingRetry(t *testing.T) {
1358
1358
m .DoMultiCacheFn = func (multi ... CacheableTTL ) * redisresults {
1359
1359
attempts ++
1360
1360
if attempts == 1 {
1361
- return & redisresults {s : []RedisResult {newResult (RedisMessage { typ : '-' , string : "LOADING Redis is loading the dataset in memory" } , nil )}}
1361
+ return & redisresults {s : []RedisResult {newResult (strmsg ( '-' , "LOADING Redis is loading the dataset in memory" ) , nil )}}
1362
1362
}
1363
- return & redisresults {s : []RedisResult {newResult (RedisMessage { typ : '+' , string : "OK" } , nil )}}
1363
+ return & redisresults {s : []RedisResult {newResult (strmsg ( '+' , "OK" ) , nil )}}
1364
1364
}
1365
1365
1366
1366
cmd := client .B ().Get ().Key ("test" ).Cache ()
@@ -1379,9 +1379,9 @@ func TestSingleClientLoadingRetry(t *testing.T) {
1379
1379
m .DoFn = func (cmd Completed ) RedisResult {
1380
1380
attempts ++
1381
1381
if attempts == 1 {
1382
- return newResult (RedisMessage { typ : '-' , string : "LOADING Redis is loading the dataset in memory" } , nil )
1382
+ return newResult (strmsg ( '-' , "LOADING Redis is loading the dataset in memory" ) , nil )
1383
1383
}
1384
- return newResult (RedisMessage { typ : '+' , string : "OK" } , nil )
1384
+ return newResult (strmsg ( '+' , "OK" ) , nil )
1385
1385
}
1386
1386
m .AcquireFn = func () wire { return & mockWire {DoFn : m .DoFn } }
1387
1387
@@ -1402,9 +1402,9 @@ func TestSingleClientLoadingRetry(t *testing.T) {
1402
1402
m .DoMultiFn = func (multi ... Completed ) * redisresults {
1403
1403
attempts ++
1404
1404
if attempts == 1 {
1405
- return & redisresults {s : []RedisResult {newResult (RedisMessage { typ : '-' , string : "LOADING Redis is loading the dataset in memory" } , nil )}}
1405
+ return & redisresults {s : []RedisResult {newResult (strmsg ( '-' , "LOADING Redis is loading the dataset in memory" ) , nil )}}
1406
1406
}
1407
- return & redisresults {s : []RedisResult {newResult (RedisMessage { typ : '+' , string : "OK" } , nil )}}
1407
+ return & redisresults {s : []RedisResult {newResult (strmsg ( '+' , "OK" ) , nil )}}
1408
1408
}
1409
1409
m .AcquireFn = func () wire { return & mockWire {DoMultiFn : m .DoMultiFn } }
1410
1410
0 commit comments