func (r *Reader) ReadValue() (*Value, []byte, error) {
	line, err := r.readLine()
	if err != nil {
		return nil, nil, err
	}
	if len(line) < 3 {
		return nil, nil, ErrInvalidSyntax
	}
	var attrs *linkedhashmap.Map
	if line[0] == TypeAttribute {
		attrs, err = r.readAttr(line)
		if err != nil {
			return nil, nil, err
		}
		line, err = r.readLine()
	}
	if line[0] == TypeBlobString && len(line) == 45 && bytes.Compare(line[:5], StreamMarkerPrefix) == 0 {
		return nil, line[5:], nil
	}
	v := &Value{
		Type:  line[0],
		Attrs: attrs,
	}
	switch v.Type {
	case TypeSimpleString:
		v.Str = string(line[1 : len(line)-2])
	case TypeBlobString:
		v.Str, err = r.readBlobString(line)
	case TypeVerbatimString:
		var s string
		s, err = r.readBlobString(line)
		if err == nil {
			if len(s) < 4 {
				err = ErrInvalidSyntax
			} else {
				v.Str = s[4:]
				v.StrFmt = s[:3]
			}
		}
	case TypeSimpleError:
		v.Err = string(line[1 : len(line)-2])
	case TypeBlobError:
		v.Err, err = r.readBlobString(line)
	case TypeNumber:
		v.Integer, err = r.readNumber(line)
	case TypeDouble:
		v.Double, err = r.readDouble(line)
	case TypeBigNumber:
		v.BigInt, err = r.readBigNumber(line)
	case TypeNull:
		if len(line) != 3 {
			err = ErrInvalidSyntax
		}
	case TypeBoolean:
		v.Boolean, err = r.readBoolean(line)
	case TypeArray, TypeSet, TypePush:
		v.Elems, err = r.readArray(line)
	case TypeMap:
		v.KV, err = r.readMap(line)
	}
	return v, nil, err
}
ReadValue parses a RESP3 value.
package resp3
import (
	"bufio"
	"bytes"
	"errors"
	"io"
	"math"
	"math/big"
	"strconv"
	"strings"
	"github.com/emirpasic/gods/maps/linkedhashmap"
)
var (
	ErrInvalidSyntax      = errors.New("resp: invalid syntax")
	ErrStreamingUnsupport = errors.New("resp: unsupported streaming")
	ErrUnknown            = errors.New("resp: unknown")
)
type Reader struct {
	*bufio.Reader
}
func NewReader(reader io.Reader) *Reader {
	return NewReaderSize(reader, 32*1024)
}
func NewReaderSize(reader io.Reader, size int) *Reader {
	return &Reader{
		Reader: bufio.NewReaderSize(reader, size),
	}
}