db

package
v0.0.0-...-77dcbbd Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package db implements key-value database functionality with prefix feature.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDataNotFound = errors.New("data was not found")
)

Functions

This section is empty.

Types

type Batch

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

func (*Batch) Del

func (b *Batch) Del(key []byte)

func (*Batch) Set

func (b *Batch) Set(key, value []byte)

type DB

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

func NewDB

func NewDB(path string) (*DB, error)

func NewInMemoryDB

func NewInMemoryDB() (*DB, error)

NewInMemoryDB returns new instance of in-memory db.

func (*DB) Close

func (db *DB) Close() error

func (*DB) Del

func (db *DB) Del(key []byte)

func (*DB) DropAll

func (db *DB) DropAll()

func (*DB) Exist

func (db *DB) Exist(key []byte) bool

func (*DB) Get

func (db *DB) Get(key []byte) ([]byte, bool)

func (*DB) Iterate

func (db *DB) Iterate(prefix []byte, limit int, reverse bool) []KeyValue

func (*DB) IterateKey

func (db *DB) IterateKey(prefix []byte, limit int, reverse bool) [][]byte

func (*DB) IterateRange

func (db *DB) IterateRange(start, end []byte, limit int, reverse bool) []KeyValue

func (*DB) NewBatch

func (db *DB) NewBatch() *Batch

func (*DB) NewReader

func (db *DB) NewReader() *Reader

func (*DB) Set

func (db *DB) Set(key, value []byte)

func (*DB) Write

func (db *DB) Write(batch *Batch)

type KeyValue

type KeyValue interface {
	Key() []byte
	Value() []byte
}

func NewKeyValue

func NewKeyValue(key, value []byte) KeyValue

type Reader

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

func (*Reader) Close

func (r *Reader) Close() error

func (*Reader) Exist

func (r *Reader) Exist(key []byte) bool

func (*Reader) Get

func (r *Reader) Get(key []byte) ([]byte, bool)

func (*Reader) Iterate

func (r *Reader) Iterate(prefix []byte, limit int, reverse bool) []KeyValue

func (*Reader) IterateKey

func (r *Reader) IterateKey(prefix []byte, limit int, reverse bool) [][]byte

func (*Reader) IterateRange

func (r *Reader) IterateRange(start, end []byte, limit int, reverse bool) []KeyValue

Directories

Path Synopsis
Package batchdb provides the prefixed db feature without diff functionality.
Package batchdb provides the prefixed db feature without diff functionality.
Package diffdb provides diff functionality, which is used for rolling back the stored data.
Package diffdb provides diff functionality, which is used for rolling back the stored data.

Jump to

Keyboard shortcuts

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