MCPcopy
hub / github.com/redis/go-redis / ReadUint

Method ReadUint

internal/proto/reader.go:489–514  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

487}
488
489func (r *Reader) ReadUint() (uint64, error) {
490 line, err := r.ReadLine()
491 if err != nil {
492 return 0, err
493 }
494 switch line[0] {
495 case RespInt, RespStatus:
496 return util.ParseUint(line[1:], 10, 64)
497 case RespString:
498 s, err := r.readStringReply(line)
499 if err != nil {
500 return 0, err
501 }
502 return util.ParseUint([]byte(s), 10, 64)
503 case RespBigInt:
504 b, err := r.readBigInt(line)
505 if err != nil {
506 return 0, err
507 }
508 if !b.IsUint64() {
509 return 0, fmt.Errorf("bigInt(%s) value out of range", b.String())
510 }
511 return b.Uint64(), nil
512 }
513 return 0, fmt.Errorf("redis: can't parse uint reply: %.100q", line)
514}
515
516func (r *Reader) ReadFloat() (float64, error) {
517 line, err := r.ReadLine()

Callers 5

readReplyMethod · 0.80
readReplyMethod · 0.80
readStreamGroupsFunction · 0.80
readReplyMethod · 0.80
readReplyMethod · 0.80

Calls 6

ReadLineMethod · 0.95
readStringReplyMethod · 0.95
readBigIntMethod · 0.95
ParseUintFunction · 0.92
StringMethod · 0.65
Uint64Method · 0.45

Tested by

no test coverage detected