kv

package
v0.0.0-...-34de315 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2018 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Badger

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

Badger is a wrapper around the badger key-value stores that implements our database interface.

func NewBadger

func NewBadger(kv *badger.DB) *Badger

NewBadger creates a new KV store wraper around a badger database.

func (*Badger) Del

func (b *Badger) Del(key []byte) error

Del will delete the key-value pair for the given key from the database, if it exists.

func (*Badger) Get

func (b *Badger) Get(key []byte) ([]byte, error)

Get will return the value for a given key, if it exists.

func (*Badger) Has

func (b *Badger) Has(key []byte) (bool, error)

Has will check if there is a value for the given key in the database.

func (*Badger) Put

func (b *Badger) Put(key []byte, val []byte) error

Put will insert a key-value pair into the database.

type Memory

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

Memory is a wrapper around an in-memory key-value store.

func NewMemory

func NewMemory() *Memory

NewMemory creates a new in-memory KV store.

func (*Memory) Del

func (m *Memory) Del(key []byte) error

Del will delete the key-value pair with the given key.

func (*Memory) Get

func (m *Memory) Get(key []byte) ([]byte, error)

Get will return the value stored under the given key.

func (*Memory) Has

func (m *Memory) Has(key []byte) (bool, error)

Has will check whether a value exists under the given key.

func (*Memory) Put

func (m *Memory) Put(key []byte, val []byte) error

Put will store the given value under the given key.

Jump to

Keyboard shortcuts

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