badger

package
v1.1.19 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultOptions

func DefaultOptions(path string) badger.Options

Types

type Badger

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

Badger implements wrapper for badger database

func New

func New(storageDir string, opts badger.Options) (*Badger, error)

New returns new instance of badger wrapper

func (*Badger) Close

func (storage *Badger) Close() error

Close properly closes badger database

func (*Badger) Connection

func (storage *Badger) Connection(name string) storage.Storage

func (*Badger) Delete

func (storage *Badger) Delete(key string) (err error)

Delete deletes a key

func (*Badger) DeleteByPrefix

func (storage *Badger) DeleteByPrefix(prefix []byte)

DeleteByPrefix iterates over keys with prefix

func (*Badger) Get

func (storage *Badger) Get(key string) (value []byte, err error)

Get returns value by key

func (*Badger) Iterate

func (storage *Badger) Iterate(fn func(key []byte, value []byte))

Iterate iterates over all keys

func (*Badger) IterateByPrefix

func (storage *Badger) IterateByPrefix(prefix []byte, limit uint64, fn func(key []byte, value []byte)) uint64

IterateByPrefix iterates over keys with prefix

func (*Badger) IterateByPrefixFrom

func (storage *Badger) IterateByPrefixFrom(prefix []byte, from []byte, limit uint64, fn func(key []byte, value []byte)) uint64

IterateByPrefixFrom iterates over keys with prefix

func (*Badger) KeysByPrefixCount

func (storage *Badger) KeysByPrefixCount(prefix []byte) uint64

func (*Badger) Reset

func (storage *Badger) Reset() (err error)

Reset deletes a key

func (*Badger) Set

func (storage *Badger) Set(key string, value []byte, exp time.Duration) (err error)

Set adds a key-value pair to the database

Jump to

Keyboard shortcuts

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