bolt

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package bolt implements the db interface with boltdb.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket bbolt.Bucket

Bucket represents a collection of items inside the database.

func (*Bucket) Bucket

func (a *Bucket) Bucket(key interface{}) db.Bucket

Bucket retrieves a bucket by key.

func (*Bucket) Create

func (a *Bucket) Create(key, value interface{}) error

Create creates a new value.

func (*Bucket) CreateBucket

func (a *Bucket) CreateBucket(key interface{}) (db.Bucket, error)

CreateBucket creates a new bucket.

func (*Bucket) Delete

func (a *Bucket) Delete(key interface{}) error

Delete removes the key from the bucket.

func (*Bucket) DeleteBucket

func (a *Bucket) DeleteBucket(key interface{}) error

DeleteBucket deletes the bucket by key.

func (*Bucket) Each

func (a *Bucket) Each(f interface{}, key interface{}, backward bool) (err error)

Each applies the function f to each values.

func (*Bucket) Get

func (a *Bucket) Get(key, value interface{}) error

Get retrieves the value for a key in the bucket.

func (*Bucket) Has

func (a *Bucket) Has(key interface{}) (bool, error)

Has checks if the bucket has the key.

func (*Bucket) IsEmpty

func (a *Bucket) IsEmpty() (bool, error)

IsEmpty checks if the bucket is empty.

func (*Bucket) MustBucket

func (a *Bucket) MustBucket(key interface{}) (db.Bucket, error)

MustBucket creates a new bucket if it doesn't already exist and returns a reference to it.

func (*Bucket) Put

func (a *Bucket) Put(key, value interface{}) error

Put sets the value for a key in the bucket.

func (*Bucket) Update

func (a *Bucket) Update(key, value interface{}) error

Update updates the value.

type DB

type DB bbolt.DB

DB represents a database.

func Open

func Open(path string) (*DB, error)

Open creates and opens a database at the given path.

func (*DB) Backup

func (a *DB) Backup(w io.Writer) error

Backup makes a backup of database.

func (*DB) Begin

func (a *DB) Begin(writable bool) (db.Tx, error)

Begin starts a new transaction.

func (*DB) Close

func (a *DB) Close() error

Close closes the database.

type Tx

type Tx bbolt.Tx

Tx represents a transaction on the database.

func (*Tx) Bucket

func (a *Tx) Bucket(key interface{}) db.Bucket

Bucket retrieves a bucket by key.

func (*Tx) Commit

func (a *Tx) Commit() error

Commit writes all changes to database.

func (*Tx) CreateBucket

func (a *Tx) CreateBucket(key interface{}) (db.Bucket, error)

CreateBucket creates a new bucket.

func (*Tx) DeleteBucket

func (a *Tx) DeleteBucket(key interface{}) error

DeleteBucket deletes the bucket by key.

func (*Tx) MustBucket

func (a *Tx) MustBucket(key interface{}) (db.Bucket, error)

MustBucket creates a new bucket if it doesn't already exist and returns a reference to it.

func (*Tx) Rollback

func (a *Tx) Rollback() error

Rollback closes the transaction and ignores all previous updates.

Jump to

Keyboard shortcuts

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