Help us shape the future of Go! Take the 2026 Go Developer Survey

memdb

package
v1.17.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name is the name of this database for database switches
	Name = "memdb"

	// DefaultSize is the default initial size of the memory database
	DefaultSize = 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

Database is an ephemeral key-value store that implements the Database interface.

func New

func New() *Database

New returns a map with the Database interface methods implemented.

func NewWithSize

func NewWithSize(size int) *Database

NewWithSize returns a map pre-allocated to the provided size with the Database interface methods implemented.

func (*Database) Close

func (db *Database) Close() error

func (*Database) Compact

func (db *Database) Compact(_, _ []byte) error

func (*Database) Delete

func (db *Database) Delete(key []byte) error

func (*Database) Get

func (db *Database) Get(key []byte) ([]byte, error)

func (*Database) Has

func (db *Database) Has(key []byte) (bool, error)

func (*Database) HealthCheck added in v0.15.6

func (db *Database) HealthCheck(context.Context) (interface{}, error)

func (*Database) NewBatch

func (db *Database) NewBatch() database.Batch

func (*Database) NewIterator

func (db *Database) NewIterator() database.Iterator

func (*Database) NewIteratorWithPrefix

func (db *Database) NewIteratorWithPrefix(prefix []byte) database.Iterator

func (*Database) NewIteratorWithStart

func (db *Database) NewIteratorWithStart(start []byte) database.Iterator

func (*Database) NewIteratorWithStartAndPrefix

func (db *Database) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator

func (*Database) Put

func (db *Database) Put(key []byte, value []byte) error

Jump to

Keyboard shortcuts

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