# package bytesutil - github.com/mediocregopher/radix/v4/internal/bytesutil - godocs.io ``` 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. ## Functions ### func AnyIntToInt64 ``` 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 ``` 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 ``` 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 ``` 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 ``` 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 ``` 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 ``` 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 ``` 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 ``` func ReadNAppend(r io.Reader, b []byte, n int) ([]byte, error) ``` ReadNAppend appends exactly n bytes from r into b. ### func ReadNDiscard ``` func ReadNDiscard(r io.Reader, n int, scratch *[]byte) error ``` ReadNDiscard discards exactly n bytes from r. ### func ReadUint ``` 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. ## Details => ?view=versions Version: v4.1.4 (latest) * Published: Aug 25, 2023 => ?view=platforms Platform: linux/amd64 => ?view=imports Imports: 5 packages * Last checked: 1 minute ago => /-/refresh?import_path=github.com/mediocregopher/radix/v4/internal/bytesutil&platform=linux/amd64 Refresh now => / Back to home => /-/search Search