db

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("key not found")
	ErrNilValue = errors.New("value is nil")
)

Package vars

Functions

This section is empty.

Types

type DB

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

DB describes local BoltDB database

func NewDB

func NewDB(path string, timeout time.Duration) (*DB, error)

NewDB creates new instance of DB

func (*DB) Close

func (db *DB) Close(delete bool) error

Close closes the DB

func (*DB) Delete

func (db *DB) Delete(key string) error

Delete removes the value from DB by provided bucket and key

func (*DB) Get

func (db *DB) Get(key string) ([]byte, error)

Get acquires value from DB by provided key

func (*DB) Keys

func (db *DB) Keys() ([]string, error)

Keys returns a list of available keys in the global bucket, sorted alphabetically

func (*DB) Purge

func (db *DB) Purge() error

Purge removes the bucket from DB

func (*DB) Put

func (db *DB) Put(key string, val []byte) error

Put sets/updates the value in DB by provided bucket and key

Jump to

Keyboard shortcuts

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