boltorm

package
Version: v0.0.0-...-b5f08d2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2017 License: AGPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGeneric          = errors.NewClass("Generic Error")
	ErrKeyAlreadyExists = ErrGeneric.NewClass("Key already exists")
	ErrKeyDoesNotExist  = ErrGeneric.NewClass("Key does not exist")
	ErrTxNotWritable    = ErrGeneric.NewClass("Transaction not writable")
)

Functions

This section is empty.

Types

type DB

type DB interface {
	Update(fn func(tx Tx) error) error
	View(fn func(tx Tx) error) error
}

func NewBoltDB

func NewBoltDB(db *bolt.DB) DB

func NewMemoryDB

func NewMemoryDB() DB

type Tx

type Tx interface {
	CreateBucketIfNotExists(name []byte) error
	Insert(bucket, key []byte, data interface{}) error
	Update(bucket, key []byte, data interface{}) error
	AddIndex(indexBucket, index, key []byte) error
	NextSequenceForBucket(bucket []byte) (uint64, error)

	Get(bucket, key []byte, data interface{}) error
	GetAll(bucket []byte, dataType interface{}) (interface{}, error)
	GetByIndex(indexBucket, dataBucket, index []byte, data interface{}) error
	GetAllByIndex(indexBucket, bucket []byte, dataType interface{}) (interface{}, error)

	RemoveKeyFromIndex(indexBucket, key []byte) error
}

Jump to

Keyboard shortcuts

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