File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Expand file tree Collapse file tree 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 {
26942694 return err
26952695 }
26962696
2697- cursor , err := rd .ReadInt ()
2697+ cursor , err := rd .ReadUint ()
26982698 if err != nil {
26992699 return err
27002700 }
2701- cmd .cursor = uint64 ( cursor )
2701+ cmd .cursor = cursor
27022702
27032703 n , err := rd .ReadArrayLen ()
27042704 if err != nil {
Original file line number Diff line number Diff line change @@ -319,6 +319,33 @@ func (r *Reader) ReadInt() (int64, error) {
319319 return 0 , fmt .Errorf ("redis: can't parse int reply: %.100q" , line )
320320}
321321
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+
322349func (r * Reader ) ReadFloat () (float64 , error ) {
323350 line , err := r .ReadLine ()
324351 if err != nil {
You can’t perform that action at this time.
0 commit comments