Documentation ¶
Overview ¶
Package mbuckets provides a thin wrapper over Bolt DB. It allows easy operations on multi-level (nested) buckets.
See https://github.com/boltdb/bolt for Bolt DB.
Index ¶
- type Bucket
- func (b *Bucket) CreateBucket() error
- func (b *Bucket) Delete(key []byte) error
- func (b *Bucket) DeleteBucket() error
- func (b *Bucket) DeleteString(key string) error
- func (b *Bucket) Get(key []byte) (value []byte, err error)
- func (b *Bucket) GetAll() ([]Item, error)
- func (b *Bucket) GetAllBucketNames() ([][]byte, error)
- func (b *Bucket) GetAllString() (map[string]string, error)
- func (b *Bucket) GetPrefix(prefix []byte) ([]Item, error)
- func (b *Bucket) GetPrefixString(prefix string) (map[string]string, error)
- func (b *Bucket) GetRange(min, max []byte) ([]Item, error)
- func (b *Bucket) GetRangeString(min, max string) (map[string]string, error)
- func (b *Bucket) GetRootBucketNames() ([][]byte, error)
- func (b *Bucket) GetString(key string) (value string, err error)
- func (b *Bucket) Insert(key, value []byte) error
- func (b *Bucket) InsertAll(items []Item) error
- func (b *Bucket) InsertAllString(items map[string]string) error
- func (b *Bucket) InsertString(key, value string) error
- func (b *Bucket) Map(fn func([]byte, []byte) error) error
- func (b *Bucket) MapPrefix(prefix []byte, fn func([]byte, []byte) error) error
- func (b *Bucket) MapRange(min, max []byte, fn func([]byte, []byte) error) error
- func (b *Bucket) Update(fn func(*bolt.Bucket, *bolt.Tx) error) error
- func (b *Bucket) View(fn func(*bolt.Bucket, *bolt.Tx) error) error
- func (b *Bucket) WithSeparator(separator []byte) *Bucket
- type DB
- func (db *DB) Bucket(name []byte) *Bucket
- func (db *DB) BucketString(name string) *Bucket
- func (db *DB) Close() error
- func (db *DB) GetAllBucketNames() ([][]byte, error)
- func (db *DB) GetAllBucketNamesWithSeparator(separator []byte) ([][]byte, error)
- func (db *DB) GetRootBucketNames() ([][]byte, error)
- func (db *DB) Map(fn func([]byte, *bolt.Bucket) error) error
- type Item
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct { DB *DB // Complete hierarchial name of the Bucket Name []byte // The Bucket Name separator Separator []byte }
Bucket represents a logical entity used to access a bolt.Bucket inside a DB
func (*Bucket) CreateBucket ¶
CreateBucket cretes the bolt.Bucket specified by this Bucket
func (*Bucket) DeleteBucket ¶
DeleteBucket deletes the bolt.Bucket specified by this Bucket
func (*Bucket) DeleteString ¶
DeleteString is a convenience wrapper over Delete for string key
func (*Bucket) Get ¶
Get retrieves the value for given a key from the bolt.Bucket specified by this Bucket
func (*Bucket) GetAll ¶
GetAll retrieves all the key/value pairs from the bolt.Bucket specified by this Bucket
func (*Bucket) GetAllBucketNames ¶
GetAllBucketNames recursively finds and returns all the bolt.Bucket names under the bolt.Bucket specified by this Bucket
func (*Bucket) GetAllString ¶
GetAllString is a convenience method to GetAll string key value pairs
func (*Bucket) GetPrefix ¶
GetPrefix retrieves all the key/value pairs from the bolt.Bucket specified by this Bucket with the given prefix
func (*Bucket) GetPrefixString ¶
GetPrefixString is a convenience method to GetPrefix for string key value pairs
func (*Bucket) GetRange ¶
GetRange retrieves all the key/value pairs from the bolt.Bucket specified by this Bucket within the given range
func (*Bucket) GetRangeString ¶
GetRangeString is a convenience method to GetRange for string key value pairs
func (*Bucket) GetRootBucketNames ¶
GetRootBucketNames returns all the top level bolt.Bucket names under the bolt.Bucket specified by this Bucket
func (*Bucket) Insert ¶
Insert puts a single key/value pair in the bolt.Bucket specified by this Bucket
func (*Bucket) InsertAll ¶
InsertAll puts multiple key/value pairs in the bolt.Bucket specified by this Bucket
func (*Bucket) InsertAllString ¶
InsertAllString is a convenience method to Insert string key value pairs
func (*Bucket) InsertString ¶
InsertString is a convenience wrapper over Insert for string key value pair
func (*Bucket) Map ¶
Map performs a view operation specified by function `fn` on all key value pairs in this Bucket
func (*Bucket) MapPrefix ¶
MapPrefix performs a view operation specified by function `fn` on all key value pairs in this Bucket with the given prefix
func (*Bucket) MapRange ¶
MapRange performs a view operation specified by function `fn` on all key value pairs in this Bucket within the given range
func (*Bucket) Update ¶
Update performs an update operation specified by function `fn` on this Bucket
func (*Bucket) WithSeparator ¶
WithSeparator overrides the separator for this Bucket with the given separator and returns a pointer to this Bucket.
The name of this Bucket and all Buckets under it must be separated by the given custom separator. Note that it is an error to mix different separators and can lead to unexpected behavior.
type DB ¶
DB embeds a bolt.DB
func OpenWith ¶
OpenWith creates/opens a bolt.DB at specified path with given permissions and options, and returns a DB enclosing the same
func (*DB) BucketString ¶
BucketString is a convenience wrapper over Bucket for string name
func (*DB) GetAllBucketNames ¶
GetAllBucketNames recursively finds and returns all the bolt.Bucket names in this DB
func (*DB) GetAllBucketNamesWithSeparator ¶
GetAllBucketNamesWithSeparator recursively finds and returns all the bolt.Bucket names in this DB using specified separator
func (*DB) GetRootBucketNames ¶
GetRootBucketNames returns all the top level bolt.Bucket names in this DB