arb

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: CC0-1.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadWithArbElem

func ReadWithArbElem(b B, elems ...keys.Element)

ReadWithArbElem is a variant of Read that recognises an arbitrary length element by its zero length and imputes its actual length by the byte buffer size and the lengths of the fixed length fields.

For reasons of space efficiency, it is not practical to use TLVs for badger database key fields, so this will panic if there is more than one arbitrary length element.

Types

type B

type B = []byte

type E

type E = error

type N added in v0.0.14

type N = int

type S

type S = string

type T

type T struct {
	Val B
}

T is an arbitrary length byte string. In any construction there can only be one with arbitrary length. Custom lengths can be created by calling New with the custom length in it, both for Read and Write operations.

func New

func New(b B) (p *T)

New creates a new arb.T. This must have the expected length for the provided byte slice as this is what the Read method will aim to copy. In general this will be a bounded field, either the final or only arbitrary length field in a key.

func NewFromString

func NewFromString(s S) (p *T)

func NewWithLen

func NewWithLen(l int) (p *T)

func (*T) Len

func (p *T) Len() int

func (*T) Read

func (p *T) Read(buf *bytes.Buffer) (el keys.Element)

func (*T) Write

func (p *T) Write(buf *bytes.Buffer)

Jump to

Keyboard shortcuts

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