utils

package
v1.202405300917.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2024 License: MIT Imports: 5 Imported by: 0

README

codecov

Utilities

Common utilities for istructsmem package

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyBytes

func CopyBytes(src []byte) []byte

Copies bytes from src

func FullBytes

func FullBytes(b []byte) bool

Returns is all bytes is max (0xFF)

func IncBytes

func IncBytes(cur []byte) (next []byte)

Increments by one bit low byte and returns the result.

Useful to obtain right margin of half-open range of partially filled clustering columns

func ReadBool

func ReadBool(buf *bytes.Buffer) (bool, error)

Reads bool from buf

func ReadByte

func ReadByte(buf *bytes.Buffer) (byte, error)

Reads byte from buf

func ReadFloat32

func ReadFloat32(buf *bytes.Buffer) (float32, error)

Reads float32 from buf

func ReadFloat64

func ReadFloat64(buf *bytes.Buffer) (float64, error)

Reads float64 from buf

func ReadInt16

func ReadInt16(buf *bytes.Buffer) (int16, error)

Reads int16 from buf

func ReadInt32

func ReadInt32(buf *bytes.Buffer) (int32, error)

Reads int32 from buf

func ReadInt64

func ReadInt64(buf *bytes.Buffer) (int64, error)

Reads int64 from buf

func ReadInt8

func ReadInt8(buf *bytes.Buffer) (int8, error)

Reads int8 from buf

func ReadShortString

func ReadShortString(buf *bytes.Buffer) (string, error)

Reads short (< 64K) string from a buffer

func ReadUInt16

func ReadUInt16(buf *bytes.Buffer) (uint16, error)

Reads uint16 from buf

func ReadUInt32

func ReadUInt32(buf *bytes.Buffer) (uint32, error)

Reads uint32 from buf

func ReadUInt64

func ReadUInt64(buf *bytes.Buffer) (uint64, error)

Reads uint64 from buf

func SafeWriteBuf

func SafeWriteBuf(b *bytes.Buffer, data any)

Writes data to buffer.

Hints:

  • To exclude slow write through binary.Write() cast user types to go-types as possible.
  • To avoid escaping values to heap during interface conversion use Write××× routines as possible.

func ToBytes

func ToBytes(value ...interface{}) []byte

Returns a slice of bytes built from the specified values, written from left to right

func WriteBool

func WriteBool(buf *bytes.Buffer, value bool)

Write bool to buf

func WriteByte

func WriteByte(buf *bytes.Buffer, value byte)

Write byte to buf

func WriteFloat32

func WriteFloat32(buf *bytes.Buffer, value float32)

Write float32 to buf

func WriteFloat64

func WriteFloat64(buf *bytes.Buffer, value float64)

Write float64 to buf

func WriteInt16

func WriteInt16(buf *bytes.Buffer, value int16)

Write int16 to buf

func WriteInt32

func WriteInt32(buf *bytes.Buffer, value int32)

Write int32 to buf

func WriteInt64

func WriteInt64(buf *bytes.Buffer, value int64)

Write int64 to buf

func WriteInt8

func WriteInt8(buf *bytes.Buffer, value int8)

Write int8 to buf

func WriteShortString

func WriteShortString(buf *bytes.Buffer, str string)

Writes short (< 64K) string into a buffer

func WriteUint16

func WriteUint16(buf *bytes.Buffer, value uint16)

Write uint16 to buf

func WriteUint32

func WriteUint32(buf *bytes.Buffer, value uint32)

Write uint32 to buf

func WriteUint64

func WriteUint64(buf *bytes.Buffer, value uint64)

Write uint64 to buf

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL