💾 Archived View for godocs.io › github.com › mediocregopher › radix › v4 › internal › bytesutil captured on 2023-11-04 at 11:43:27. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-09-28)
-=-=-=-=-=-=-
import "github.com/mediocregopher/radix/v4/internal/bytesutil"
Package bytesutil provides utility functions for working with bytes and byte streams that are useful when working with the RESP protocol.
func AnyIntToInt64(m interface{}) int64
AnyIntToInt64 converts a value of any of Go's integer types (signed and unsigned) into a signed int64.
If m is not of one of Go's built in integer types the call will panic.
func Expand(b []byte, n int) []byte
Expand expands the given byte slice to exactly n bytes. It will not return nil.
If cap(b) < n then a new slice will be allocated.
func ParseInt(b []byte) (int64, error)
ParseInt is a specialized version of strconv.ParseInt that parses a base-10 encoded signed integer from a []byte.
This can be used to avoid allocating a string, since strconv.ParseInt only takes a string.
func ParseUint(b []byte) (uint64, error)
ParseUint is a specialized version of strconv.ParseUint that parses a base-10 encoded integer from a []byte.
This can be used to avoid allocating a string, since strconv.ParseUint only takes a string.
func ReadBytesDelim(br resp.BufferedReader) ([]byte, error)
ReadBytesDelim reads a line from br and checks that the line ends with \r\n, returning the line without \r\n.
func ReadFloat(r io.Reader, precision, n int, scratch *[]byte) (float64, error)
ReadFloat reads the next n bytes from r as a 64 bit floating point number with the given precision.
func ReadInt(r io.Reader, n int, scratch *[]byte) (int64, error)
ReadInt reads the next n bytes from r as a signed 64 bit integer.
func ReadIntDelim(br resp.BufferedReader) (int64, error)
ReadIntDelim reads the current line from br as an integer, checks that the line ends with \r\n, and returns the integer.
func ReadNAppend(r io.Reader, b []byte, n int) ([]byte, error)
ReadNAppend appends exactly n bytes from r into b.
func ReadNDiscard(r io.Reader, n int, scratch *[]byte) error
ReadNDiscard discards exactly n bytes from r.
func ReadUint(r io.Reader, n int, scratch *[]byte) (uint64, error)
ReadUint reads the next n bytes from r as an unsigned 64 bit integer.