kvbadger

package module
v0.0.0-...-1555df1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2025 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Overview

Package kvbadger implements Visvasity Key-Value DB API adapter for the Badger Database.

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
}

func New

func New(db *badger.DB) *Database

New returns a key-value database instance backed by the given badger database.

func (*Database) NewSnapshot

func (d *Database) NewSnapshot(ctx context.Context) (*Snapshot, error)

NewSnapshot returns a snapshot, which is just a read-only transaction.

func (*Database) NewTransaction

func (d *Database) NewTransaction(ctx context.Context) (*Transaction, error)

NewTransaction returns a new read-write transaction.

type Snapshot

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

func (Snapshot) Ascend

func (t Snapshot) Ascend(ctx context.Context, beg, end string, errp *error) iter.Seq2[string, io.Reader]

Ascend returns key-value pairs in a given range through the iterator, in ascending order.

func (Snapshot) Commit

func (t Snapshot) Commit(ctx context.Context) error

Commit commits the transaction.

func (Snapshot) Delete

func (t Snapshot) Delete(ctx context.Context, k string) error

Delete removes the key-value pair with the given key.

func (Snapshot) Descend

func (t Snapshot) Descend(ctx context.Context, beg, end string, errp *error) iter.Seq2[string, io.Reader]

Descend returns key-value pairs in a given range through the iterator, in descending order.

func (*Snapshot) Discard

func (s *Snapshot) Discard(ctx context.Context) error

func (Snapshot) Get

func (t Snapshot) Get(ctx context.Context, k string) (io.Reader, error)

Get returns the value for a given key.

func (Snapshot) Scan

func (t Snapshot) Scan(ctx context.Context, errp *error) iter.Seq2[string, io.Reader]

Scan reads all keys in the database through the iterator, in no-particular order.

func (Snapshot) Set

func (t Snapshot) Set(ctx context.Context, k string, v io.Reader) error

Set stores a key-value pair.

type Transaction

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

func (Transaction) Ascend

func (t Transaction) Ascend(ctx context.Context, beg, end string, errp *error) iter.Seq2[string, io.Reader]

Ascend returns key-value pairs in a given range through the iterator, in ascending order.

func (Transaction) Commit

func (t Transaction) Commit(ctx context.Context) error

Commit commits the transaction.

func (Transaction) Delete

func (t Transaction) Delete(ctx context.Context, k string) error

Delete removes the key-value pair with the given key.

func (Transaction) Descend

func (t Transaction) Descend(ctx context.Context, beg, end string, errp *error) iter.Seq2[string, io.Reader]

Descend returns key-value pairs in a given range through the iterator, in descending order.

func (Transaction) Get

func (t Transaction) Get(ctx context.Context, k string) (io.Reader, error)

Get returns the value for a given key.

func (*Transaction) Rollback

func (t *Transaction) Rollback(ctx context.Context) error

Rollback drops the transaction.

func (Transaction) Scan

func (t Transaction) Scan(ctx context.Context, errp *error) iter.Seq2[string, io.Reader]

Scan reads all keys in the database through the iterator, in no-particular order.

func (Transaction) Set

func (t Transaction) Set(ctx context.Context, k string, v io.Reader) error

Set stores a key-value pair.

Jump to

Keyboard shortcuts

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