bolt

package
v0.0.0-...-ccb62fa Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: MIT Imports: 8 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 []byte) db.Bucket

Bucket retrieves a bucket by key.

func (*Bucket) Create

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

Create creates a new value.

func (*Bucket) CreateBucket

func (a *Bucket) CreateBucket(key []byte) (db.Bucket, error)

CreateBucket creates a new bucket.

func (*Bucket) Delete

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

Delete removes the key from the bucket.

func (*Bucket) DeleteBucket

func (a *Bucket) DeleteBucket(key []byte) error

DeleteBucket deletes the bucket by key.

func (*Bucket) Each

func (a *Bucket) Each(f interface{}, min, max []byte) error

Each applies the function f to each values.

func (*Bucket) Get

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

Get retrieves the value for a key in the bucket.

func (*Bucket) Has

func (a *Bucket) Has(key []byte) (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) Put

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

Put sets the value for a key in the bucket.

func (*Bucket) RequireBucket

func (a *Bucket) RequireBucket(key []byte) (db.Bucket, error)

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

func (*Bucket) Update

func (a *Bucket) Update(key []byte, 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) 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.

func (*DB) CopyTo

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

CopyTo copies the database to the writer.

type Tx

type Tx bbolt.Tx

Tx represents a transaction on the database.

func (*Tx) Bucket

func (a *Tx) Bucket(key []byte) 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 []byte) (db.Bucket, error)

CreateBucket creates a new bucket.

func (*Tx) DeleteBucket

func (a *Tx) DeleteBucket(key []byte) error

DeleteBucket deletes the bucket by key.

func (*Tx) RequireBucket

func (a *Tx) RequireBucket(key []byte) (db.Bucket, error)

RequireBucket 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