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 @@ -2693,11 +2693,11 @@ func (cmd *ScanCmd) readReply(rd *proto.Reader) error {
26932693 return err
26942694 }
26952695
2696- cursor , err := rd .ReadInt ()
2696+ cursor , err := rd .ReadUint ()
26972697 if err != nil {
26982698 return err
26992699 }
2700- cmd .cursor = uint64 ( cursor )
2700+ cmd .cursor = cursor
27012701
27022702 n , err := rd .ReadArrayLen ()
27032703 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