lazyslice

package
v0.0.0-...-1c999d7 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MaxElementsLazyTree = 256

MaxElementsLazyTree each node of the tree can have maximum 256 elements

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	// contains filtered or unexported fields
}

Array can be interpreted two ways: - as byte slice - as serialized append-only array of up to 255 byte slices Serialization is optimized by analyzing maximum length of the data element

func ArrayFromBytes

func ArrayFromBytes(data []byte, maxNumElements ...int) *Array

func EmptyArray

func EmptyArray(maxNumElements ...int) *Array

func MakeArray

func MakeArray(element ...interface{}) *Array

func MakeArrayFromData

func MakeArrayFromData(element ...[]byte) *Array

func (*Array) AsTree

func (a *Array) AsTree() *Tree

func (*Array) At

func (a *Array) At(idx int) []byte

func (*Array) Bytes

func (a *Array) Bytes() []byte

func (*Array) ForEach

func (a *Array) ForEach(fun func(i int, data []byte) bool)

func (*Array) NumElements

func (a *Array) NumElements() int

func (*Array) Parsed

func (a *Array) Parsed() [][]byte

func (*Array) ParsedString

func (a *Array) ParsedString() string

func (*Array) Push

func (a *Array) Push(data []byte) int

func (*Array) PutAtIdx

func (a *Array) PutAtIdx(idx byte, data []byte)

PutAtIdx puts data at index, panics if array has no element at that index

func (*Array) PutAtIdxGrow

func (a *Array) PutAtIdxGrow(idx byte, data []byte)

PutAtIdxGrow puts data at index, grows array of necessary

func (*Array) SetData

func (a *Array) SetData(data []byte)

func (*Array) SetEmptyArray

func (a *Array) SetEmptyArray()

type Tree

type Tree struct {
	// contains filtered or unexported fields
}

Tree is a read only interface to Array, which is interpreted as a tree

func TreeEmpty

func TreeEmpty() *Tree

func TreeFromBytes

func TreeFromBytes(data []byte) *Tree

func TreeFromTrees

func TreeFromTrees(trees ...*Tree) *Tree

func (*Tree) Bytes

func (st *Tree) Bytes() []byte

Bytes recursively updates bytes in the tree from leaves

func (*Tree) BytesAtPath

func (st *Tree) BytesAtPath(path TreePath) []byte

BytesAtPath returns serialized for of the element at globalpath

func (*Tree) ForEach

func (st *Tree) ForEach(fun func(i byte, data []byte) bool, path TreePath)

func (*Tree) ForEachIndex

func (st *Tree) ForEachIndex(fun func(i byte) bool, path TreePath)

func (*Tree) NumElements

func (st *Tree) NumElements(path TreePath) int

NumElements returns number of elements of the Array at the end of globalpath

func (*Tree) Subtree

func (st *Tree) Subtree(path TreePath) *Tree

type TreePath

type TreePath []byte

func Path

func Path(p ...interface{}) TreePath

func (TreePath) Bytes

func (p TreePath) Bytes() []byte

func (TreePath) Hex

func (p TreePath) Hex() string

func (TreePath) String

func (p TreePath) String() string

Jump to

Keyboard shortcuts

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