Versions in this module Expand all Collapse all v1 v1.0.0 Jan 12, 2018 Changes in this version + const Always + const EverySecond + const Never + var ErrDatabaseClosed = errors.New("database closed") + var ErrIndexExists = errors.New("index exists") + var ErrInvalid = errors.New("invalid database") + var ErrInvalidOperation = errors.New("invalid operation") + var ErrInvalidSyncPolicy = errors.New("invalid sync policy") + var ErrNotFound = errors.New("not found") + var ErrPersistenceActive = errors.New("persistence active") + var ErrShrinkInProcess = errors.New("shrink is in-process") + var ErrTxClosed = errors.New("tx closed") + var ErrTxIterating = errors.New("tx is iterating") + var ErrTxNotWritable = errors.New("tx not writable") + func Desc(less func(a, b string) bool) func(a, b string) bool + func IndexBinary(a, b string) bool + func IndexFloat(a, b string) bool + func IndexInt(a, b string) bool + func IndexJSON(path string) func(a, b string) bool + func IndexJSONCaseSensitive(path string) func(a, b string) bool + func IndexRect(a string) (min, max []float64) + func IndexString(a, b string) bool + func IndexUint(a, b string) bool + func Match(key, pattern string) bool + func Point(coords ...float64) string + func Rect(min, max []float64) string + type Config struct + AutoShrinkDisabled bool + AutoShrinkMinSize int + AutoShrinkPercentage int + OnExpired func(keys []string) + SyncPolicy SyncPolicy + type DB struct + func Open(path string) (*DB, error) + func (db *DB) Begin(writable bool) (*Tx, error) + func (db *DB) Close() error + func (db *DB) CreateIndex(name, pattern string, less ...func(a, b string) bool) error + func (db *DB) CreateSpatialIndex(name, pattern string, rect func(item string) (min, max []float64)) error + func (db *DB) DropIndex(name string) error + func (db *DB) Indexes() ([]string, error) + func (db *DB) Load(rd io.Reader) error + func (db *DB) ReadConfig(config *Config) error + func (db *DB) ReplaceIndex(name, pattern string, less ...func(a, b string) bool) error + func (db *DB) ReplaceSpatialIndex(name, pattern string, rect func(item string) (min, max []float64)) error + func (db *DB) Save(wr io.Writer) error + func (db *DB) SetConfig(config Config) error + func (db *DB) Shrink() error + func (db *DB) Update(fn func(tx *Tx) error) error + func (db *DB) View(fn func(tx *Tx) error) error + type IndexOptions struct + CaseInsensitiveKeyMatching bool + type SetOptions struct + Expires bool + TTL time.Duration + type SyncPolicy int + type Tx struct + func (tx *Tx) Ascend(index string, iterator func(key, value string) bool) error + func (tx *Tx) AscendEqual(index, pivot string, iterator func(key, value string) bool) error + func (tx *Tx) AscendGreaterOrEqual(index, pivot string, iterator func(key, value string) bool) error + func (tx *Tx) AscendKeys(pattern string, iterator func(key, value string) bool) error + func (tx *Tx) AscendLessThan(index, pivot string, iterator func(key, value string) bool) error + func (tx *Tx) AscendRange(index, greaterOrEqual, lessThan string, iterator func(key, value string) bool) error + func (tx *Tx) Commit() error + func (tx *Tx) CreateIndex(name, pattern string, less ...func(a, b string) bool) error + func (tx *Tx) CreateIndexOptions(name, pattern string, opts *IndexOptions, less ...func(a, b string) bool) error + func (tx *Tx) CreateSpatialIndex(name, pattern string, rect func(item string) (min, max []float64)) error + func (tx *Tx) CreateSpatialIndexOptions(name, pattern string, opts *IndexOptions, ...) error + func (tx *Tx) Delete(key string) (val string, err error) + func (tx *Tx) DeleteAll() error + func (tx *Tx) Descend(index string, iterator func(key, value string) bool) error + func (tx *Tx) DescendEqual(index, pivot string, iterator func(key, value string) bool) error + func (tx *Tx) DescendGreaterThan(index, pivot string, iterator func(key, value string) bool) error + func (tx *Tx) DescendKeys(pattern string, iterator func(key, value string) bool) error + func (tx *Tx) DescendLessOrEqual(index, pivot string, iterator func(key, value string) bool) error + func (tx *Tx) DescendRange(index, lessOrEqual, greaterThan string, iterator func(key, value string) bool) error + func (tx *Tx) DropIndex(name string) error + func (tx *Tx) Get(key string) (val string, err error) + func (tx *Tx) GetLess(index string) (func(a, b string) bool, error) + func (tx *Tx) GetRect(index string) (func(s string) (min, max []float64), error) + func (tx *Tx) Indexes() ([]string, error) + func (tx *Tx) Intersects(index, bounds string, iterator func(key, value string) bool) error + func (tx *Tx) Len() (int, error) + func (tx *Tx) Nearby(index, bounds string, iterator func(key, value string, dist float64) bool) error + func (tx *Tx) Rollback() error + func (tx *Tx) Set(key, value string, opts *SetOptions) (previousValue string, replaced bool, err error) + func (tx *Tx) TTL(key string) (time.Duration, error)