badgerwrapper

package module
v0.0.0-...-a31c3ac Latest Latest
Warning

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

Go to latest
Published: May 9, 2018 License: GPL-3.0 Imports: 5 Imported by: 0

README

badgerwrapper

A simple wrapper around badger DB for some of the more commonly used functions

Documentation

Overview

Wrapper for regularly used badgerDB functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToUint64

func BytesToUint64(b []byte) uint64

func Uint64ToBytes

func Uint64ToBytes(i uint64) []byte

Types

type Badger

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

Badger is a simple helper for db access

func NewBadgerDB

func NewBadgerDB() (Badger, error)

NewBadgerDB returns a new badgerdb

func NewBadgerDBFromPath

func NewBadgerDBFromPath(path string) (Badger, error)

NewBadgerDB returns a new badgerdb

func (Badger) Delete

func (b Badger) Delete(key []byte) error

func (Badger) Get

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

Get return the value of a given key

func (Badger) IncrementKeyValue

func (b Badger) IncrementKeyValue(key []byte) (uint64, error)

func (Badger) IterView

func (b Badger) IterView() ([]KVP, error)

func (Badger) SearchPrefix

func (b Badger) SearchPrefix(prefix string) ([]KVP, error)

SearchPrefix returns all key value paris which match teh specified prefix

func (Badger) Update

func (b Badger) Update(key, value []byte) error

Update update a set of key/values in the db

func (Badger) UpdateWithTTL

func (b Badger) UpdateWithTTL(key, value []byte, ttl int) error

type KVP

type KVP struct {
	Key   []byte
	Value []byte
}

KVP simple named key value pair storage

Jump to

Keyboard shortcuts

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