codecs

package
v0.0.0-...-5fd011b Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidTarget is returned when the target is not a pointer.
	ErrInvalidTarget = errors.New("must pass a pointer to decode a value to")
	// ErrUnknownType is returned when the type is unknown.
	ErrUnknownType = errors.New("unknown type")
	// ErrByteSliceSize is returned when the byte slice provided doesn't have
	// enough capacity to hold the encoded value.
	ErrByteSliceSize = errors.New("receiving byte array doesn't have enough capacity")
	// ErrNullByte is returned when a string to be encoded contains a null byte.
	ErrNullByte = errors.New("can't encode strings that contain a null byte")
	// ErrInvalidTime is returned when an encoded time can't be marshaled to time.Time.
	ErrInvalidTime = errors.New("can't marshal to time.Time")
)

Functions

func DecodeValue

func DecodeValue(b []byte, v interface{}) (int, error)

DecodeValue decodes the first value in slice b into the location defined by pointer v.

func EncodeValue

func EncodeValue(b []byte, v interface{}, inverse bool) (int, error)

EncodeValue encodes value v to the beginning of byte slice b, optionally in inverse order, and returns the number of bytes written.

func EncodedSize

func EncodedSize(v interface{}) (int, error)

EncodedSize returns the number of bytes required to encode the value v.

func SizeNext

func SizeNext(b []byte) (int, error)

SizeNext returns the number of bytes encompassing the next encoded value in the byte slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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