@@ -124,7 +124,7 @@ func (r *Reader) ReadLine() ([]byte, error) {
124
124
return line , nil
125
125
}
126
126
127
- // readLine that returns an error if:
127
+ // readLine returns an error if:
128
128
// - there is a pending read error;
129
129
// - or line does not end with \r\n.
130
130
func (r * Reader ) readLine () ([]byte , error ) {
@@ -403,7 +403,7 @@ func (r *Reader) ReadArrayLen() (int, error) {
403
403
case RespArray , RespSet , RespPush :
404
404
return replyLen (line )
405
405
default :
406
- return 0 , fmt .Errorf ("redis: can't parse array(array /set/push) reply: %.100q" , line )
406
+ return 0 , fmt .Errorf ("redis: can't parse array/set/push reply: %.100q" , line )
407
407
}
408
408
}
409
409
@@ -446,6 +446,15 @@ func (r *Reader) ReadMapLen() (int, error) {
446
446
}
447
447
}
448
448
449
+ // DiscardNext read and discard the data represented by the next line.
450
+ func (r * Reader ) DiscardNext () error {
451
+ line , err := r .readLine ()
452
+ if err != nil {
453
+ return err
454
+ }
455
+ return r .Discard (line )
456
+ }
457
+
449
458
// Discard the data represented by line.
450
459
func (r * Reader ) Discard (line []byte ) (err error ) {
451
460
if len (line ) == 0 {
@@ -486,15 +495,6 @@ func (r *Reader) Discard(line []byte) (err error) {
486
495
return fmt .Errorf ("redis: can't parse %.100q" , line )
487
496
}
488
497
489
- // DiscardNext read and discard the data represented by the next line.
490
- func (r * Reader ) DiscardNext () error {
491
- line , err := r .readLine ()
492
- if err != nil {
493
- return err
494
- }
495
- return r .Discard (line )
496
- }
497
-
498
498
func replyLen (line []byte ) (n int , err error ) {
499
499
n , err = util .Atoi (line [1 :])
500
500
if err != nil {
@@ -515,7 +515,7 @@ func replyLen(line []byte) (n int, err error) {
515
515
return n , nil
516
516
}
517
517
518
- // IsNilReply detect redis.Nil of RESP2.
518
+ // IsNilReply detects redis.Nil of RESP2.
519
519
func IsNilReply (line []byte ) bool {
520
520
return len (line ) == 3 &&
521
521
(line [0 ] == RespString || line [0 ] == RespArray ) &&
0 commit comments