kv

package
v0.2.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: GPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// EntryNotFoundError is an error for a storage entry not found
	EntryNotFoundError = "EntryNotFoundError"
)

Variables

This section is empty.

Functions

func New

func New(options basedb.Options) (basedb.IDb, error)

New create new instance of Badger db

Types

type BadgerDb

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

BadgerDb struct

func (*BadgerDb) Close

func (b *BadgerDb) Close()

Close close db

func (*BadgerDb) CountByCollection added in v0.0.4

func (b *BadgerDb) CountByCollection(prefix []byte) (int64, error)

CountByCollection return the object count for all keys under specified prefix(bucket)

func (*BadgerDb) Delete added in v0.1.4

func (b *BadgerDb) Delete(prefix []byte, key []byte) error

Delete key in specific prefix

func (*BadgerDb) Get

func (b *BadgerDb) Get(prefix []byte, key []byte) (basedb.Obj, bool, error)

Get return value for specified key

func (*BadgerDb) GetAll added in v0.1.9

func (b *BadgerDb) GetAll(prefix []byte, handler func(int, basedb.Obj) error) error

GetAll returns all the items of a given collection

func (*BadgerDb) GetMany added in v0.1.8

func (b *BadgerDb) GetMany(prefix []byte, keys [][]byte, iterator func(basedb.Obj) error) error

GetMany return values for the given keys

func (*BadgerDb) RemoveAllByCollection added in v0.0.18

func (b *BadgerDb) RemoveAllByCollection(prefix []byte) error

RemoveAllByCollection cleans all items in a collection

func (*BadgerDb) Set

func (b *BadgerDb) Set(prefix []byte, key []byte, value []byte) error

Set save value with key to storage

func (*BadgerDb) SetMany added in v0.1.8

func (b *BadgerDb) SetMany(prefix []byte, n int, next func(int) (basedb.Obj, error)) error

SetMany save many values with the given keys in a single badger transaction

func (*BadgerDb) Update added in v0.1.11

func (b *BadgerDb) Update(fn func(basedb.Txn) error) error

Update is a gateway to badger db Update function creating and managing a read-write transaction

Jump to

Keyboard shortcuts

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