bolt

package module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2021 License: MIT Imports: 3 Imported by: 1

README

BoltDB

BoltDB is a Mojura backend wrapper for BoltDB.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() backend.Initializer

New will create a new initializer with default options

func NewWithOpts

func NewWithOpts(opts *bolt.Options) backend.Initializer

NewWithOpts will create a new initializer with the provided opts

Types

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

Backend is the interface wrapper for bolt DB to be used as a Backend

func (*Backend) Close

func (b *Backend) Close() error

Close will close the underlying DB

func (*Backend) ReadTransaction

func (b *Backend) ReadTransaction(fn func(backend.Transaction) error) (err error)

ReadTransaction will initialize a new read-only transaction

func (*Backend) Transaction

func (b *Backend) Transaction(fn func(backend.Transaction) error) (err error)

Transaction will initialize a new read-write transaction

type Bucket

type Bucket struct {
	// contains filtered or unexported fields
}

Bucket represents a boltDB bucket

func (*Bucket) Cursor

func (b *Bucket) Cursor() backend.Cursor

Cursor will return a new cursor

func (*Bucket) Delete

func (b *Bucket) Delete(key []byte) error

Delete will delete a value

func (*Bucket) DeleteBucket added in v0.2.0

func (b *Bucket) DeleteBucket(key []byte) (err error)

DeleteBucket will get a bucket

func (*Bucket) ForEach

func (b *Bucket) ForEach(fn func(key, value []byte) error) (err error)

ForEach will iterate through all the entries within a bucket

func (*Bucket) Get

func (b *Bucket) Get(key []byte) (value []byte)

Get will get a value

func (*Bucket) GetBucket

func (b *Bucket) GetBucket(key []byte) (bkt backend.Bucket)

GetBucket will get a bucket

func (*Bucket) GetOrCreateBucket

func (b *Bucket) GetOrCreateBucket(key []byte) (bkt backend.Bucket, err error)

GetOrCreateBucket will get or create a bucket

func (*Bucket) Put

func (b *Bucket) Put(key, value []byte) error

Put will put a value

type Initializer

type Initializer struct {
	// contains filtered or unexported fields
}

Initializer initializes a boltDB backend

func (*Initializer) New

func (i *Initializer) New(filename string) (b backend.Backend, err error)

New will return a new instance of Backend

type Transaction

type Transaction struct {
	// contains filtered or unexported fields
}

Transaction represents a boltDB transaction

func (*Transaction) DeleteBucket added in v0.2.1

func (t *Transaction) DeleteBucket(key []byte) (err error)

GetBucket will get a bucket

func (*Transaction) GetBucket

func (t *Transaction) GetBucket(key []byte) (bkt backend.Bucket)

GetBucket will get a bucket

func (*Transaction) GetOrCreateBucket

func (t *Transaction) GetOrCreateBucket(key []byte) (bkt backend.Bucket, err error)

GetOrCreateBucket will get or create a bucket

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL