boltq

package module
v0.0.0-...-2369ca2 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EQ = iota
	RANGE
	IN
	ANY
	NOT
)

Variables

This section is empty.

Functions

func DeserializeComposite

func DeserializeComposite(serialized []byte) ([][]byte, error)

deserializeComposite deserializes a composite key that was stored in an index

func SerializeComposite

func SerializeComposite(compositeKey [][]byte) []byte

serializeComposite serializes the composite key to be stored in an index

func TxDelete

func TxDelete(tx *bolt.Tx, collection []byte, keys ...[]byte) (err error)

func TxDeleteIndex

func TxDeleteIndex(tx *bolt.Tx, collection, index []byte) error

TxDeleteIndex deletes the specified index in the given transaction

func TxIndex

func TxIndex(tx *bolt.Tx, collection, index, value []byte, compositeKey [][]byte) error

Index records the composite key associated with the value for use in index queries

func TxIndexMatchAll

func TxIndexMatchAll(tx *bolt.Tx, collection, index []byte, values ...[]byte) ([][]byte, error)

TxIndexMatchAll queries for items using the given index and the values that were indexed

func TxIndexMatchAny

func TxIndexMatchAny(tx *bolt.Tx, collection, index []byte, values ...[]byte) ([][]byte, error)

TxIndexMatchAny queries for items using the given index and the values that were indexed

func TxQuery

func TxQuery(tx *bolt.Tx, query *Query) ([][]byte, error)

TxQuery executes the query in the provided transaction

func TxStore

func TxStore(tx *bolt.Tx, collection []byte, compositeKey [][]byte, value []byte) error

TxStore places the value in the datastore that tx came from. The collection key is used for the root bucket of the storage while the composite key is used as the path to the final storage loaction

Types

type DataStore

type DataStore struct {
	*bolt.DB
}

DataStore adds composite key support to BoltDB

func (DataStore) DeleteIndex

func (ds DataStore) DeleteIndex(collection, index []byte) error

TxDeleteIndex deletes the specified index

func (DataStore) Index

func (ds DataStore) Index(collection, index, value []byte, compositeKey [][]byte) error

Index records the composite key associated with the value for use in index queries

func (DataStore) Store

func (ds DataStore) Store(collection []byte, compositeKey [][]byte, value []byte) error

Store places the value in the datastore. The collection key is used for the root bucket of the storage while the composite key is used as the path to the final storage loaction

type Query

type Query struct {
	Collection []byte
	Terms      []*Term
}

Query holds all information specific to a db query

func NewQuery

func NewQuery(collection []byte, terms ...*Term) *Query

NewQuery creates a new query from the provided parameters

type Term

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

Term holds parameters of a query term

func Any

func Any() *Term

Any creates a wildcard query term

func Eq

func Eq(key []byte) *Term

Eq creates a new equals query term

func EqAll

func EqAll(keys [][]byte) []*Term

EqAll creates Eq terms for all provided keys

func In

func In(keys ...[]byte) *Term

In creates a new In query term

func Not

func Not(keys ...[]byte) *Term

Not creates a NOT IN query term

func Range

func Range(lower, upper []byte) *Term

Range creates a new range query term

Jump to

Keyboard shortcuts

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