File tree 2 files changed +29
-2
lines changed
2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -2694,11 +2694,11 @@ func (cmd *ScanCmd) readReply(rd *proto.Reader) error {
2694
2694
return err
2695
2695
}
2696
2696
2697
- cursor , err := rd .ReadInt ()
2697
+ cursor , err := rd .ReadUint ()
2698
2698
if err != nil {
2699
2699
return err
2700
2700
}
2701
- cmd .cursor = uint64 ( cursor )
2701
+ cmd .cursor = cursor
2702
2702
2703
2703
n , err := rd .ReadArrayLen ()
2704
2704
if err != nil {
Original file line number Diff line number Diff line change @@ -319,6 +319,33 @@ func (r *Reader) ReadInt() (int64, error) {
319
319
return 0 , fmt .Errorf ("redis: can't parse int reply: %.100q" , line )
320
320
}
321
321
322
+ func (r * Reader ) ReadUint () (uint64 , error ) {
323
+ line , err := r .ReadLine ()
324
+ if err != nil {
325
+ return 0 , err
326
+ }
327
+ switch line [0 ] {
328
+ case RespInt , RespStatus :
329
+ return util .ParseUint (line [1 :], 10 , 64 )
330
+ case RespString :
331
+ s , err := r .readStringReply (line )
332
+ if err != nil {
333
+ return 0 , err
334
+ }
335
+ return util .ParseUint ([]byte (s ), 10 , 64 )
336
+ case RespBigInt :
337
+ b , err := r .readBigInt (line )
338
+ if err != nil {
339
+ return 0 , err
340
+ }
341
+ if ! b .IsUint64 () {
342
+ return 0 , fmt .Errorf ("bigInt(%s) value out of range" , b .String ())
343
+ }
344
+ return b .Uint64 (), nil
345
+ }
346
+ return 0 , fmt .Errorf ("redis: can't parse uint reply: %.100q" , line )
347
+ }
348
+
322
349
func (r * Reader ) ReadFloat () (float64 , error ) {
323
350
line , err := r .ReadLine ()
324
351
if err != nil {
You can’t perform that action at this time.
0 commit comments