common

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeyPrefixSeparator is used to separate prefix and key
	KeyPrefixSeparator = ";;;"
)

Variables

This section is empty.

Functions

func MakeKey

func MakeKey(key []byte, prefixes ...[]byte) []byte

MakeKey constructs a key from the key and prefixes

func MakePrefix

func MakePrefix(prefixes ...[]byte) (result []byte)

MakePrefix creates a prefix string

func SplitPrefix

func SplitPrefix(prefixes []byte) [][]byte

SplitPrefix splits joined prefixes into their individual parts

Types

type NoopLogger

type NoopLogger struct{}

func (*NoopLogger) Debugf

func (*NoopLogger) Debugf(string, ...interface{})

func (*NoopLogger) Errorf

func (*NoopLogger) Errorf(string, ...interface{})

func (*NoopLogger) Infof

func (*NoopLogger) Infof(string, ...interface{})

func (*NoopLogger) Warningf

func (*NoopLogger) Warningf(string, ...interface{})

type Record

type Record struct {
	Key    []byte `json:"key"`
	Value  []byte `json:"value"`
	Prefix []byte `json:"prefix"`
}

Record represents an item in the database

func NewFromKeyValue

func NewFromKeyValue(key []byte, value []byte) *Record

NewFromKeyValue takes a key and creates a Record

func NewRecord

func NewRecord(key, value []byte, prefixes ...[]byte) *Record

NewRecord creates a key value object. The prefixes provided is joined together and prepended to the key before insertion.

func (*Record) Equal

func (r *Record) Equal(other *Record) bool

Equal performs equality check with another Record

func (*Record) GetKey

func (r *Record) GetKey() []byte

GetKey creates and returns the key

func (*Record) IsEmpty

func (r *Record) IsEmpty() bool

IsEmpty checks whether the object is empty

func (*Record) Scan

func (r *Record) Scan(dest interface{}) error

Scan decodes the value into dest. The record value must be msgpack encoded (e.g created using util.ToBytes)

Jump to

Keyboard shortcuts

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