Documentation ¶
Overview ¶
Package boltdd contains a wrapper around BBoltDB to deduplicate writes and encode values using mgspack. (dd stands for de-duplicate)
Index ¶
- func IsErrNotFound(e error) bool
- func NotFound(name string) error
- type Bucket
- func (b *Bucket) BoltBucket() *bbolt.Bucket
- func (b *Bucket) Bucket(name []byte) *Bucket
- func (b *Bucket) CreateBucket(name []byte) (*Bucket, error)
- func (b *Bucket) CreateBucketIfNotExists(name []byte) (*Bucket, error)
- func (b *Bucket) Delete(key []byte) error
- func (b *Bucket) DeleteBucket(name []byte) error
- func (b *Bucket) Get(key []byte, obj interface{}) error
- func (b *Bucket) Put(key []byte, val interface{}) error
- type DB
- type ErrNotFound
- type Tx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsErrNotFound ¶
IsErrNotFound returns true if the error is an ErrNotFound error.
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
func (*Bucket) BoltBucket ¶
BoltBucket returns the internal bolt.Bucket for this Bucket. Only valid for the duration of the current transaction.
func (*Bucket) Bucket ¶
Bucket represents a boltdb Bucket and its associated metadata necessary for write deduplication. Like bolt.Buckets it is only valid for the duration of the transaction that created it.
func (*Bucket) CreateBucket ¶
CreateBucket creates a new bucket at the given key and returns the new bucket. Returns an error if the key already exists, if the bucket name is blank, or if the bucket name is too long. The bucket instance is only valid for the lifetime of the transaction.
func (*Bucket) CreateBucketIfNotExists ¶
CreateBucketIfNotExists creates a new bucket if it doesn't already exist and returns a reference to it. The bucket instance is only valid for the lifetime of the transaction.
func (*Bucket) Delete ¶
Delete removes a key from the bucket. If the key does not exist then nothing is done and a nil error is returned. Returns an error if the bucket was created from a read-only transaction.
func (*Bucket) DeleteBucket ¶
DeleteBucket deletes a child bucket. Returns an error if the bucket corresponds to a non-bucket key or another error is encountered. No error is returned if the bucket does not exist.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps an underlying bolt.DB to create write de-duplicating buckets and msgpack encoded values.
type ErrNotFound ¶
type ErrNotFound struct {
// contains filtered or unexported fields
}
ErrNotFound is returned when a key is not found.
func (*ErrNotFound) Error ¶
func (e *ErrNotFound) Error() string