util

package
v0.0.0-...-667e438 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeOrderPreservingVarUint64

func DecodeOrderPreservingVarUint64(bytes []byte) (uint64, int)

DecodeOrderPreservingVarUint64 decodes the number from the bytes obtained from method 'EncodeOrderPreservingVarUint64'. Also, returns the number of bytes that are consumed in the process

func EncodeOrderPreservingVarUint64

func EncodeOrderPreservingVarUint64(number uint64) []byte

EncodeOrderPreservingVarUint64 returns a byte-representation for a uint64 number such that all zero-bits starting bytes are trimmed in order to reduce the length of the array For preserving the order in a default bytes-comparison, first byte contains the number of remaining bytes. The presence of first byte also allows to use the returned bytes as part of other larger byte array such as a composite-key representation in db

Types

type RangeArray

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

a simple sorted range [closed, open) array (not tree), invalid range is not allow and PANIC it has been tested outside of this projected

func (RangeArray) Find

func (ra RangeArray) Find(pos uint64) int

-1 indicate not found

func (RangeArray) Get

func (ra RangeArray) Get() [][2]uint64

func (*RangeArray) Insert

func (ra *RangeArray) Insert(r [2]uint64)

add or merge

Jump to

Keyboard shortcuts

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