database

package
v1.1.25 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: GPL-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 DB

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

func New

func New(engine DBPutGetter) (*DB, error)

New creates a new instance of a database.

func (*DB) Close

func (d *DB) Close() error

Close the database engine.

func (*DB) Get

func (d *DB) Get(key []byte) ([]byte, error)

Get a record based on key.

func (*DB) NewIterator

func (d *DB) NewIterator(slice *util.Range, ro *opt.ReadOptions) iterator.Iterator

NewIterator creates a new database iterator.

func (*DB) Put

func (d *DB) Put(key, value []byte) error

Put a record into the db.

func (*DB) Write

func (d *DB) Write(batch *leveldb.Batch, wo *opt.WriteOptions) error

Write batch write.

type DBPutGetter

type DBPutGetter interface {
	Get(key []byte, ro *opt.ReadOptions) (value []byte, err error)
	Put(key, value []byte, wo *opt.WriteOptions) error
	Close() error
	Write(batch *leveldb.Batch, wo *opt.WriteOptions) error
	NewIterator(slice *util.Range, ro *opt.ReadOptions) iterator.Iterator
}

DBPutGetter represents a database engine.

type Database

type Database interface {
	Put(key, value []byte) error
	Get(key []byte) ([]byte, error)
	Close() error
	Write(batch *leveldb.Batch, wo *opt.WriteOptions) error
	NewIterator(slice *util.Range, ro *opt.ReadOptions) iterator.Iterator
}

Database represents the database functionalities.

Jump to

Keyboard shortcuts

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