db

package
v0.0.36 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRaft added in v0.0.30

func GetRaft(ctx context.Context) *badger.DB

func Open added in v0.0.19

func Open(ctx context.Context, path string, logLevel ...string) (context.Context, *badger.DB)

func OpenRaft added in v0.0.30

func OpenRaft(ctx context.Context, path string) (context.Context, *badger.DB)

func Set

func SetKeyChangeObserver added in v0.0.30

func SetKeyChangeObserver(ctx context.Context, obs func(context.Context, *badger.KVList) error)

Types

type Iter added in v0.0.30

type Iter interface {
	Rewind()
	Valid() bool
	Next()
	Key() []byte
	Value(value func([]byte) error) error
	Close()
}

type IterOpts added in v0.0.30

type IterOpts struct {
	Prefix         []byte
	PrefetchValues bool
	PrefetchSize   int
	Reverse        bool
}

type Observer added in v0.0.30

type Observer struct {
	Silent   bool
	OnChange func(context.Context, *badger.KVList) error
	// contains filtered or unexported fields
}

func (*Observer) Changed added in v0.0.30

func (cb *Observer) Changed(kv *badger.KVList) error

type Provider added in v0.0.30

type Provider interface {
	With(func(db *badger.DB) error) error
	NewTransaction(update bool) Txn
	Txn(update bool, f func(txn Txn) error) error
}

func Get

func Get(ctx context.Context) Provider

type Txn added in v0.0.30

type Txn interface {
	Set(key, value []byte) error
	SetTTL(key, value []byte, ttl time.Duration) error

	// Get retrieves a key and calls value with the data. When the key is not found
	// and nofFound is present then notFound is called.
	Get(key []byte, value func(val []byte) error, notFound ...func() error) error
	Has(key []byte) bool
	Delete(key []byte, notFound ...func() error) error
	Close() error

	Iter(IterOpts) Iter
}

Jump to

Keyboard shortcuts

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