Back to godoc.org
github.com/dfuse-io/kvdb

Package kvdb

v0.0.1
Latest Go to latest

The latest major version is .

Published: Jun 23, 2020 | License: Apache-2.0 | Module: github.com/dfuse-io/kvdb

Index

Variables

var B = func(s string) []byte {
	out, err := hex.DecodeString(s)
	if err != nil {
		panic(err)
	}

	return out
}

B is a shortcut for (must) hex.DecodeString

var (
	ErrNotFound = errors.New("not found")
)
var H = hex.EncodeToString

H is a shortcut for hex.EncodeToString

func BlockNum

func BlockNum(blockID string) uint32

func BoolToByte

func BoolToByte(value bool) byte

func ByteToBool

func ByteToBool(value []byte) bool

func FromHexUint16

func FromHexUint16(input string) (uint16, error)

func FromHexUint64

func FromHexUint64(input string) (uint64, error)

func FromRevBlockNum64

func FromRevBlockNum64(input string) (uint64, error)

func HexName

func HexName(name uint64) string

func HexRevBlockNum

func HexRevBlockNum(blockNum uint32) string

func HexRevBlockNum64

func HexRevBlockNum64(blockNum uint64) string

func HexUint16

func HexUint16(input uint16) string

func HexUint32

func HexUint32(input uint32) string

func HexUint64

func HexUint64(input uint64) string

func IncreaseBlockIDSuffix

func IncreaseBlockIDSuffix(blockID string) string

increaseBlockIDSuffix increases the last bits of the blockID, to make it to the next block in an InfiniteRange search. WARN: if the last characters are: "ffffffff", then it will overflow, and return a *lower* key.

func MustProtoMarshal

func MustProtoMarshal(obj proto.Message) []byte

func ReversedBlockID

func ReversedBlockID(blockID string) string

func ReversedUint16

func ReversedUint16(input uint16) uint16

func StringListToBytes

func StringListToBytes(value []string, separator string) []byte

func Uint64ToBytes

func Uint64ToBytes(value uint64) []byte

type BlockIdentifier

type BlockIdentifier string

BlockIdentifier is present only for testing purposes. This wrap a string of the format `<Num><letter>` and add block ref methods `Num` and `ID`. This way in tests, it's easy to create block identifier for example `1a` or `3c` to represents blocks num + id consicely.

func (BlockIdentifier) ID

func (i BlockIdentifier) ID() string

func (BlockIdentifier) Num

func (i BlockIdentifier) Num() (out uint64)

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier