boltdb

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltDB

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

func New

func New(dbFile string) (*BoltDB, error)

New creates a new Bolt DB todo: add options and make it possible to use other encode/decode methods

func (*BoltDB) Close

func (db *BoltDB) Close() error

func (*BoltDB) Delete

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

func (*BoltDB) Find

func (db *BoltDB) Find(key []byte) keyvaluedb.Iterator

func (*BoltDB) First

func (db *BoltDB) First() keyvaluedb.Iterator

func (*BoltDB) Last

func (db *BoltDB) Last() keyvaluedb.Iterator

func (*BoltDB) Path

func (db *BoltDB) Path() string

func (*BoltDB) Read

func (db *BoltDB) Read(key []byte, v any) (bool, error)

func (*BoltDB) StartTx

func (db *BoltDB) StartTx() (keyvaluedb.DBTransaction, error)

func (*BoltDB) Write

func (db *BoltDB) Write(key []byte, v any) error

type DecodeFn

type DecodeFn func(data []byte, v any) error

type EncodeFn

type EncodeFn func(v any) ([]byte, error)

type Itr

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

func NewIterator

func NewIterator(db *bolt.DB, bucket []byte, d DecodeFn) *Itr

func (*Itr) Close

func (it *Itr) Close() error

func (*Itr) Key

func (it *Itr) Key() []byte

func (*Itr) Next

func (it *Itr) Next()

func (*Itr) Prev

func (it *Itr) Prev()

func (*Itr) Valid

func (it *Itr) Valid() bool

func (*Itr) Value

func (it *Itr) Value(v any) error

type Tx

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

func NewBoltTx

func NewBoltTx(db *bolt.DB, bucket []byte, e EncodeFn, d DecodeFn) (*Tx, error)

func (*Tx) Commit

func (t *Tx) Commit() error

func (*Tx) Delete

func (t *Tx) Delete(key []byte) error

func (*Tx) Read

func (t *Tx) Read(key []byte, value any) (bool, error)

func (*Tx) Rollback

func (t *Tx) Rollback() error

func (*Tx) Write

func (t *Tx) Write(key []byte, value any) error

Jump to

Keyboard shortcuts

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