db

package
v0.0.6-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

README

DB

Key/value database implemented using badger-db, the exposed APIs are simplified and should abstract away most of the badger-specific code.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteBucket

func DeleteBucket(name string) error

DeleteBucket - Deletes a bucket from the filesystem and rootDB

Types

type Bucket

type Bucket struct {
	Log *logrus.Entry
	// contains filtered or unexported fields
}

Bucket - Badger database and namespaced logger

func GetBucket

func GetBucket(name string) (*Bucket, error)

GetBucket returns a namespaced database, names are mapped to directoires thru the rootDB which stores Name<->UUID pairs, this allows us to support bucket names with arbitrary string values

func (*Bucket) Delete

func (b *Bucket) Delete(key string) error

Delete - Delete a key/value

func (*Bucket) Get

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

Get - Get a value for a given key (simplified API)

func (*Bucket) List

func (b *Bucket) List(prefix string) ([]string, error)

List - Returns a list of keys filtered by prefix. Note that modify this list will not affect the database.

func (*Bucket) Map

func (b *Bucket) Map(prefix string) (map[string][]byte, error)

Map - Returns a map of key/values filtered by prefix. Note that modify this map will not affect the database.

func (*Bucket) Set

func (b *Bucket) Set(key string, value []byte) error

Set - Set a key/value (simplified API)

Jump to

Keyboard shortcuts

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