Documentation ¶
Index ¶
- Variables
- type Bucket
- func (b *Bucket) Bucket(name string) *Bucket
- func (b *Bucket) CreateBucketIfNotExists(name string) (*Bucket, error)
- func (b *Bucket) Cursor() *Cursor
- func (b *Bucket) Delete(key string) error
- func (b *Bucket) Get(key string, out interface{}) error
- func (b *Bucket) NextID() (string, error)
- func (b *Bucket) Put(key string, in interface{}) error
- func (b *Bucket) Raw() *bolt.Bucket
- type Cursor
- func (c *Cursor) Delete() error
- func (c *Cursor) First(out interface{}) (string, error)
- func (c *Cursor) Last(out interface{}) (string, error)
- func (c *Cursor) Next(out interface{}) (string, error)
- func (c *Cursor) Prev(out interface{}) (string, error)
- func (c *Cursor) Raw() *bolt.Cursor
- func (c *Cursor) Seek(key string, out interface{}) (string, error)
- type DB
- type Tx
Constants ¶
This section is empty.
Variables ¶
var ( // ErrCursorEOF is a marker error signifying that the end of the // cursor has been reached. ErrCursorEOF = errors.New("End of Cursor") // ErrCursorBucket is a marker error signifying that the value is // actually a nested bucket. ErrCursorBucket = errors.New("Cursor is at bucket") )
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
Bucket is a wrapper around *bolt.Bucket
func (*Bucket) Bucket ¶
Bucket is a wrapper around (*bolt.Bucket).Bucket() which takes a string for the bucket name in place of a []byte.
func (*Bucket) CreateBucketIfNotExists ¶
CreateBucketIfNotExists is a wrapper around (*bolt.Bucket).CreateBucketIfNotExists which takes a string for the key in place of a []byte.
func (*Bucket) Delete ¶
Delete is a wrapper around (*bolt.Bucket).Delete() which takes a string for the key name in place of a []byte.
func (*Bucket) Get ¶
Get is a wrapper around (*bolt.Bucket).Get() which takes a key and a struct to unmarshal into and returns an error if the key does not exist or the Unmarshaling failed.
func (*Bucket) NextID ¶
NextID is a loose wrapper around (*bolt.Bucket).NextSequence() which will return the next sequence from the DB in base32. This may be changed later, but if this happens, it will be ensured that any new IDs will not conflict with lower IDs.
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
Cursor is a wrapper around *bolt.Cursor
func (*Cursor) First ¶
First is a wrapper around (*bolt.Cursor).First()
First takes a struct to unmarshal into and returns the key along with any errors that occured.
ErrCursorEOF will be returned if the bucket is empty.
func (*Cursor) Last ¶
Last is a wrapper around (*bolt.Cursor).Last()
Last takes a struct to unmarshal into and returns the key along with any errors that occured.
ErrCursorEOF will be returned if the bucket is empty.
func (*Cursor) Next ¶
Next is a wrapper around (*bolt.Cursor).Next()
Next takes a struct to unmarshal into and returns the key along with any errors that occured.
ErrCursorEOF will be returned if the cursor is at the end of the bucket.
func (*Cursor) Prev ¶
Prev is a wrapper around (*bolt.Cursor).Prev()
Prev takes a struct to unmarshal into and returns the key along with any errors that occured.
ErrCursorEOF will be returned if the cursor is at the beginning of the bucket.
func (*Cursor) Seek ¶
Seek is a wrapper around (*bolt.Cursor).Seek()
Prev takes the target key and a struct to unmarshal into and returns the found key along with any errors that occured.
Because this is a wrapper around (*bolt.Cursor).Seek(), if a key does not exist, the next key (and value) will be used.
ErrCursorEOF will be returned if the key does not exist and no keys follow.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a wrapper around *bolt.DB
func Open ¶
Open is a wrapper around bolt.Open which will create a *DB from the resulting *bolt.DB.
NOTE: Options are not currently supported. If you need fancy options set on the underlying *bolt.DB, please use NewDB and pass in the created underlying *bolt.DB yourself.
func (*DB) EnsureBucket ¶
EnsureBucket is an addition to the API which will ensure a bucket exists and return an error if it doesn't exist and fails to be created.
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx is a wrapper around *bolt.Tx
func (*Tx) Bucket ¶
Bucket is a wrapper around (*bolt.Tx).Bucket() which takes a string for the key in place of a []byte.
func (*Tx) CreateBucketIfNotExists ¶
CreateBucketIfNotExists is a wrapper around (*bolt.Tx).CreateBucketIfNotExists which takes a string for the key in place of a []byte.