kvtest

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunTest

func RunTest(t *testing.T, fnc Func, opts *Options)

RunTest runs all tests for key-value implementations.

func RunTestLocal

func RunTestLocal(t *testing.T, open kv.OpenPathFunc, opts *Options)

RunTestLocal is a wrapper for RunTest that automatically creates a temporary directory and opens a database.

Types

type Func

type Func func(t testing.TB) kv.KV

Func is a constructor for database implementations. It returns an empty database and a function to destroy it.

type Options

type Options struct {
	NoLocks bool // not safe for concurrent writes
	NoTx    bool // implementation doesn't support proper transactions
}

type Test

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

func NewTest

func NewTest(t testing.TB, db kv.KV) *Test

func (Test) Del

func (t Test) Del(key kv.Key)

func (Test) Expect

func (t Test) Expect(k kv.Key, exp kv.Value)

func (Test) ExpectIt

func (t Test) ExpectIt(it kv.Iterator, exp []kv.Pair)

func (Test) Get

func (t Test) Get(key kv.Key) (kv.Value, error)

func (Test) NotExists

func (t Test) NotExists(k kv.Key)

func (Test) Put

func (t Test) Put(key kv.Key, val kv.Value)

func (Test) Scan

func (t Test) Scan(exp []kv.Pair, opts ...kv.IteratorOption)

func (Test) ScanReset

func (t Test) ScanReset(exp []kv.Pair, opts ...kv.IteratorOption)

Jump to

Keyboard shortcuts

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