Documentation ¶
Index ¶
- Constants
- func Complement(subExprs interface{}, src *Col, result *map[int]struct{}) (err error)
- func EvalAllIDs(src *Col, result *map[int]struct{}) (err error)
- func EvalQuery(q interface{}, src *Col, result *map[int]struct{}) (err error)
- func EvalUnion(exprs []interface{}, src *Col, result *map[int]struct{}) (err error)
- func GetIn(doc interface{}, path []string) (ret []interface{})
- func IntRange(intFrom interface{}, expr map[string]interface{}, src *Col, ...) (err error)
- func Intersect(subExprs interface{}, src *Col, result *map[int]struct{}) (err error)
- func Lookup(lookupValue interface{}, expr map[string]interface{}, src *Col, ...) (err error)
- func PathExistence(hasPath interface{}, expr map[string]interface{}, src *Col, ...) (err error)
- func StrHash(str string) int
- type Col
- func (col *Col) AllIndexes() (ret [][]string)
- func (col *Col) ApproxDocCount() int
- func (col *Col) Delete(id int) error
- func (col *Col) ForEachDoc(fun func(id int, doc []byte) (moveOn bool))
- func (col *Col) ForEachDocInPage(page, total int, fun func(id int, doc []byte) bool)
- func (col *Col) Index(idxPath []string) (err error)
- func (col *Col) Insert(doc map[string]interface{}) (id int, err error)
- func (col *Col) InsertRecovery(id int, doc map[string]interface{}) (err error)
- func (col *Col) Read(id int) (doc map[string]interface{}, err error)
- func (col *Col) Unindex(idxPath []string) error
- func (col *Col) Update(id int, doc map[string]interface{}) error
- func (col *Col) UpdateBytesFunc(id int, update func(origDoc []byte) (newDoc []byte, err error)) error
- func (col *Col) UpdateFunc(id int, ...) error
- type DB
- func (db *DB) AllCols() (ret []string)
- func (db *DB) Close() error
- func (db *DB) ColExists(name string) bool
- func (db *DB) Create(name string) error
- func (db *DB) Drop(name string) error
- func (db *DB) Dump(dest string) error
- func (db *DB) ForceUse(name string) *Col
- func (db *DB) Rename(oldName, newName string) error
- func (db *DB) Scrub(name string) error
- func (db *DB) Truncate(name string) error
- func (db *DB) Use(name string) *Col
Constants ¶
const ( DOC_DATA_FILE = "dat_" // Prefix of partition collection data file name. DOC_LOOKUP_FILE = "id_" // Prefix of partition hash table (ID lookup) file name. INDEX_PATH_SEP = "!" // Separator between index keys in index directory name. )
const (
PART_NUM_FILE = "number_of_partitions" // DB-collection-partition-number-configuration file name
)
Variables ¶
This section is empty.
Functions ¶
func Complement ¶
Calculate complement of sub-query results.
func EvalAllIDs ¶
Put all document IDs into result.
func EvalQuery ¶
Main entrance to query processor - evaluate a query and put result into result map (as map keys).
func GetIn ¶
func GetIn(doc interface{}, path []string) (ret []interface{})
Resolve the attribute(s) in the document structure along the given path.
func IntRange ¶
func IntRange(intFrom interface{}, expr map[string]interface{}, src *Col, result *map[int]struct{}) (err error)
Look for indexed integer values within the specified integer range.
func Lookup ¶
func Lookup(lookupValue interface{}, expr map[string]interface{}, src *Col, result *map[int]struct{}) (err error)
Value equity check ("attribute == value") using hash lookup.
Types ¶
type Col ¶
type Col struct {
// contains filtered or unexported fields
}
Collection has data partitions and some index meta information.
func (*Col) ApproxDocCount ¶
Return approximate number of documents in the collection.
func (*Col) ForEachDoc ¶
Do fun for all documents in the collection.
func (*Col) ForEachDocInPage ¶
Divide the collection into roughly equally sized pages, and do fun on all documents in the specified page.
func (*Col) InsertRecovery ¶
Insert a document with the specified ID into the collection (incl. index). Does not place partition/schema lock.
func (*Col) UpdateBytesFunc ¶
func (col *Col) UpdateBytesFunc(id int, update func(origDoc []byte) (newDoc []byte, err error)) error
UpdateBytesFunc will update a document bytes. update func will get current document bytes and should return bytes of updated document; updated document should be valid JSON; provided buffer could be modified (reused for returned value); non-nil error will be propagated back and returned from UpdateBytesFunc.
func (*Col) UpdateFunc ¶
func (col *Col) UpdateFunc(id int, update func(origDoc map[string]interface{}) (newDoc map[string]interface{}, err error)) error
UpdateFunc will update a document. update func will get current document and should return updated document; provided document should NOT be modified; non-nil error will be propagated back and returned from UpdateFunc.
type DB ¶
Database structures.
func (*DB) ColExists ¶
ColExists returns true only if the given collection name exists in the database.
func (*DB) ForceUse ¶
ForceUse creates a collection if one does not yet exist. Returns collection handle. Panics on error.