db

package module
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: MIT Imports: 9 Imported by: 0

README

db

a key-value file system database

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConflict = badger.ErrConflict
View Source
var ErrKeyNotFound = badger.ErrKeyNotFound
View Source
var ErrStopIterate = errors.New("stop iterate")

Functions

func ToBytes

func ToBytes(data any) []byte

Types

type DB

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

func New

func New(dirs ...string) (*DB, error)

or set env: DATABASE_DIR

func (*DB) Close

func (t *DB) Close()

func (*DB) ConcurrencyList added in v2.0.3

func (t *DB) ConcurrencyList(prefix string, concurrency int, fn func(key string, value []byte) error) error

func (*DB) ConflictRetryTxn

func (t *DB) ConflictRetryTxn(fn func(txn *Txn) error) error

func (*DB) Dec

func (t *DB) Dec(txn *Txn, key string, step int64) (int64, error)

func (*DB) Del

func (t *DB) Del(txn *Txn, key string) error

func (*DB) Get

func (t *DB) Get(txn *Txn, key string) ([]byte, error)

func (*DB) Has

func (t *DB) Has(txn *Txn, key string) (bool, error)

func (*DB) Inc

func (t *DB) Inc(txn *Txn, key string, step int64) (int64, error)

return new value

func (*DB) List added in v2.0.1

func (t *DB) List(prefix string, beginKey string, keyOnly bool, fn func(key string, value []byte) error) error

func (*DB) Set

func (t *DB) Set(txn *Txn, key string, value any) error

func (*DB) Txn

func (t *DB) Txn(fn func(txn *Txn) error, readOnly ...bool) error

func (*DB) Unmarshal

func (t *DB) Unmarshal(txn *Txn, key string, value any) error

type Txn

type Txn struct {
	*badger.Txn
}

Jump to

Keyboard shortcuts

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