boltdb

package
v0.0.0-...-7294114 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const InMemoryMode = ":memory:"

InMemoryMode used to store ramdom db into temporal folder

Variables

View Source
var DBB *bolt.DB

DBB boltdb instance pointer

View Source
var ErrorBucketNotFound = errors.New("Bucket not found")

ErrorBucketNotFound error type for bucket not found

Functions

func AND

func AND(s1 []uint64, s2 []uint64) []uint64

AND operation for index query results

func Initialize

func Initialize(path string, options *bolt.Options)

Initialize the DBB instance pointer to a valid boltdb

func KeyInt

func KeyInt(v uint64) []byte

KeyInt returns an 8-byte big endian representation of v.

func NOTIN

func NOTIN(s1 []uint64, s2 []uint64) []uint64

NOTIN operation for index query results Returns elements from s1 that are not in s2

func NewInstance

func NewInstance(path string, options *bolt.Options) (*bolt.DB, error)

NewInstance creates a new instance of BoltDB wrapper

func OR

func OR(s1 []uint64, s2 []uint64) []uint64

OR operation for index query results

Types

type Collection

type Collection struct {
	//DB is a pointer to bolt DB
	DB *bolt.DB
	//Name is the collection name used for bucket name
	Name string
}

Collection sets

func (Collection) Delete

func (c Collection) Delete(key []byte) error

Delete removess an item into collection under key parameter

func (Collection) Fetch

func (c Collection) Fetch(id uint64) ([]byte, error)

Fetch returns an item from collection

func (Collection) FetchAll

func (c Collection) FetchAll() ([][]byte, error)

FetchAll fetch all saved items

func (Collection) FetchBy

func (c Collection) FetchBy(key []byte) ([]byte, error)

FetchBy returns an item from collection given a key

func (Collection) Save

func (c Collection) Save(item CollectionItem) (uint64, error)

Save an item into collection setting autoincrement ID

func (Collection) SaveAs

func (c Collection) SaveAs(key []byte, item interface{}) error

SaveAs saves an item into collection under key parameter

func (Collection) Update

func (c Collection) Update(item CollectionItem) error

Update an item into collection with current item ID

type CollectionItem

type CollectionItem interface {
	SetID(id uint64)
	ID() uint64
}

CollectionItem is the item into a collection

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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