boltplus

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2016 License: MIT Imports: 9 Imported by: 0

README

BoltPlus GoDoc Version

BoltPlus is a layer on top of boltdb which add some nice features:

  • Snappy Compression
  • Nested Buckets with dot notation
  • Find operations working with gojee queries
  • Commandline Client
  • HTTP Server with REST API

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB wraps the boltdb handle

func New

func New(filename string) (*DB, error)

New opens a database

func (*DB) Backup

func (db *DB) Backup(target io.Writer) error

Backup performs a hot backup of the whole database

func (*DB) Buckets

func (db *DB) Buckets() ([]string, error)

Buckets returns a list of all buckets and subbuckets

func (*DB) Close

func (db *DB) Close()

Close closes the db

func (*DB) Delete

func (db *DB) Delete(bucketPath, key string) error

Delete deletes a doc from a bucket

func (*DB) Find

func (db *DB) Find(bucketPath, filterExpression string) (chan *Pair, error)

Find searches a bucket for documents

func (*DB) FindPrefix

func (db *DB) FindPrefix(bucketPath, prefix, filterExpression string) (chan *Pair, error)

FindPrefix searches a bucket for documents

func (*DB) FindRange

func (db *DB) FindRange(bucketPath, start, end, filterExpression string) (chan *Pair, error)

FindRange searches a bucket for documents

func (*DB) Get

func (db *DB) Get(bucketPath, key string) (Object, error)

Get retrieves a doc from a bucket

func (*DB) GetAll

func (db *DB) GetAll(bucketPath string) (chan *Pair, error)

GetAll returns all docs in a bucket

func (*DB) GetPrefix

func (db *DB) GetPrefix(bucketPath, prefix string) (chan *Pair, error)

GetPrefix returns all docs in a bucket matching a prefix

func (*DB) GetRange

func (db *DB) GetRange(bucketPath, start, end string) (chan *Pair, error)

GetRange returns all docs in a bucket matching a prefix

func (*DB) Put

func (db *DB) Put(bucketPath, key string, val Object) error

Put inserts a doc into a bucket

func (*DB) Size

func (db *DB) Size() (int64, error)

Size return the size of the db in Bytes

func (*DB) Tx

func (db *DB) Tx(writable bool) (*Transaction, error)

Tx creates a new transaction. Do not forget to commit all writing transactions and to close read and write messages!

type Object

type Object map[string]interface{}

type Pair

type Pair struct {
	Key   string                 `json:"key"`
	Value map[string]interface{} `json:"value"`
}

Pair is a key value pair

type Transaction

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

Transaction represents represents a bold db transaction and exposes the query and update routines usage: ``` tx, err := db.NewTransaction() defer tx.Close() tx.Get(...) ... tx.Put(...) tx.Commit() ```

func (*Transaction) Backup

func (tx *Transaction) Backup(target io.Writer) error

Backup performs a hot backup of the whole database

func (*Transaction) Buckets

func (tx *Transaction) Buckets() ([]string, error)

Buckets returns a list of all buckets and subbuckets

func (*Transaction) Close

func (tx *Transaction) Close() error

Close closes the transaction. If neither Commit nor Rollback were called before, it rollbacks the transaction

func (*Transaction) Commit

func (tx *Transaction) Commit() error

Commit commits and closes the transaction

func (*Transaction) Delete

func (tx *Transaction) Delete(bucketPath, key string) error

Delete deletes a doc from a bucket

func (*Transaction) Find

func (tx *Transaction) Find(bucketPath, filterExpression string) (chan *Pair, error)

Find searches a bucket for documents

func (*Transaction) FindPrefix

func (tx *Transaction) FindPrefix(bucketPath, prefix, filterExpression string) (chan *Pair, error)

FindPrefix searches a bucket for documents

func (*Transaction) FindRange

func (tx *Transaction) FindRange(bucketPath, start, end, filterExpression string) (chan *Pair, error)

FindRange searches a bucket for documents

func (*Transaction) Get

func (tx *Transaction) Get(bucketPath, key string) (map[string]interface{}, error)

Get retrieves a doc from a bucket

func (*Transaction) GetAll

func (tx *Transaction) GetAll(bucketPath string) (chan *Pair, error)

GetAll returns all docs in a bucket

func (*Transaction) GetPrefix

func (tx *Transaction) GetPrefix(bucketPath, prefix string) (chan *Pair, error)

GetPrefix returns all docs in a bucket matching a prefix

func (*Transaction) GetRange

func (tx *Transaction) GetRange(bucketPath, start, end string) (chan *Pair, error)

GetRange returns all docs in a bucket matching a prefix

func (*Transaction) Put

func (tx *Transaction) Put(bucketPath, key string, val map[string]interface{}) error

Put inserts a doc into a bucket

func (*Transaction) Rollback

func (tx *Transaction) Rollback() error

Rollback discards all changes and closes the transaction

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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