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

Method ReadFloat

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

Source from the content-addressed store, hash-verified

514}
515
516func (r *Reader) ReadFloat() (float64, error) {
517 line, err := r.ReadLine()
518 if err != nil {
519 return 0, err
520 }
521 switch line[0] {
522 case RespFloat:
523 return r.readFloat(line)
524 case RespStatus:
525 return strconv.ParseFloat(util.BytesToString(line[1:]), 64)
526 case RespString:
527 s, err := r.readStringReply(line)
528 if err != nil {
529 return 0, err
530 }
531 return strconv.ParseFloat(s, 64)
532 }
533 return 0, fmt.Errorf("redis: can't parse float reply: %.100q", line)
534}
535
536// ReadStringInto reads a string-typed reply directly into buf, avoiding the
537// per-call allocation that ReadString incurs. It returns the number of bytes

Callers 15

readReplyMethod · 0.80
readReplyMethod · 0.80
readReplyMethod · 0.80
readReplyMethod · 0.80
readReplyMethod · 0.80
readReplyMethod · 0.80
readReplyMethod · 0.80
readReplyMethod · 0.80
readReplyMethod · 0.80
readReplyMethod · 0.80
readReplyMethod · 0.80

Calls 4

ReadLineMethod · 0.95
readFloatMethod · 0.95
readStringReplyMethod · 0.95
BytesToStringFunction · 0.92

Tested by 1