arb

package
v1.2.15 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: GPL-2.0, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadWithArbElem

func ReadWithArbElem(b []byte, 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 T

type T struct {
	Val []byte
}

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 []byte) (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 string) (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