boltDB_Engine

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketNotFoundError

type BucketNotFoundError struct {
	Identifier string
}

BucketNotFoundError is returned when a bucket/table is not found

func (BucketNotFoundError) Error

func (e BucketNotFoundError) Error() string

type DB

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

DB is a wrapper for the DB database library

func NewDB

func NewDB(dbFileName string) (*DB, error)

NewDB creates a wrapper object for a NewDB database to creates new or load an existing DB. dbFileName: the path where the BoltDB file is stored on disk

func (*DB) Close

func (b *DB) Close() (err error)

Close closes the database and runs other cleanup tasks

func (*DB) Delete

func (b *DB) Delete(identifier string, key key.Key) error

Delete removes a key from the database

func (*DB) GetBytes

func (b *DB) GetBytes(identifier string, key key.Key) (value []byte, err error)

GetBytes gets a value from the database using a byte key

func (*DB) GetBytesSafe

func (b *DB) GetBytesSafe(identifier string, key key.Key) ([]byte, error)

GetBytesSafe attempts to get a value from the database, and returns nil if not found

func (*DB) GetDBFileName

func (b *DB) GetDBFileName() string

func (*DB) Len

func (b *DB) Len(identifier string) (int, error)

func (*DB) SetBytes

func (b *DB) SetBytes(identifier string, key key.Key, value []byte) error

SetBytes sets a value in the database using a byte key

type ErrKeyNotFound

type ErrKeyNotFound struct {
	Identifier string
	Key        []byte
}

DatabaseExistsError is returned when a database already exists when trying to create it

func (ErrKeyNotFound) Error

func (e ErrKeyNotFound) Error() string

Jump to

Keyboard shortcuts

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