Help us shape the future of Go! Take the 2026 Go Developer Survey

badgerdb

package
v1.16.19 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

Database is a wrapper around Badger database that implements the database.Database interface

func New

func New(path string, config *badger.Options) (*Database, error)

New creates a new Badger database instance

func (*Database) Close

func (db *Database) Close() error

Close closes the database

func (*Database) Compact

func (db *Database) Compact(start, limit []byte) error

Compact compacts the database

func (*Database) Delete

func (db *Database) Delete(key []byte) error

Delete removes a key

func (*Database) Get

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

Get retrieves a value by key

func (*Database) Has

func (db *Database) Has(key []byte) (bool, error)

Has returns true if the key exists in the database

func (*Database) HealthCheck

func (db *Database) HealthCheck(ctx context.Context) (interface{}, error)

HealthCheck returns nil if the database is healthy

func (*Database) NewBatch

func (db *Database) NewBatch() database.Batch

NewBatch creates a new batch

func (*Database) NewIterator

func (db *Database) NewIterator() database.Iterator

NewIterator creates a new iterator

func (*Database) NewIteratorWithPrefix

func (db *Database) NewIteratorWithPrefix(prefix []byte) database.Iterator

NewIteratorWithPrefix creates an iterator with a prefix

func (*Database) NewIteratorWithStart

func (db *Database) NewIteratorWithStart(start []byte) database.Iterator

NewIteratorWithStart creates an iterator with a start key

func (*Database) NewIteratorWithStartAndPrefix

func (db *Database) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator

NewIteratorWithStartAndPrefix creates an iterator with both start and prefix

func (*Database) Put

func (db *Database) Put(key []byte, value []byte) error

Put stores a key-value pair

func (*Database) Stat

func (db *Database) Stat(property string) (string, error)

Stat returns database statistics

Jump to

Keyboard shortcuts

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