lmdbtest

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2016 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Destroy

func Destroy(env *lmdb.Env)

Destroy closes env and removes its directory from the file system.

func NewEnv

func NewEnv(opt *EnvOptions) (env *lmdb.Env, err error)

NewEnv returns a test environment with the given options at a temporary path.

func OpenDBI

func OpenDBI(env *lmdb.Env, name string, flags uint) (lmdb.DBI, error)

OpenDBI is a helper that opens a transaction, opens the named database, commits the transaction, and returns the open DBI handle to the caller.

func OpenRoot

func OpenRoot(env *lmdb.Env, flags uint) (lmdb.DBI, error)

OpenRoot is a helper that opens a transaction, opens the root database, commits the transaction, and returns the open DBI handle to the caller.

func Put

func Put(env *lmdb.Env, dbi lmdb.DBI, items ItemList) error

Put writes items to the handle dbi in env.

Types

type EnvOptions

type EnvOptions struct {
	MaxReaders int
	MaxDBs     int
	MapSize    int64
	Flags      uint
}

EnvOptions specifies an environment configuration for a test involving an LMDB database.

type Item

type Item interface {
	Key() []byte
	Val() []byte
}

Item is an interface for database items.

type ItemList

type ItemList interface {
	Len() int
	Item(i int) Item
}

ItemList is a list of database items.

type SimpleItem

type SimpleItem struct {
	K string
	V string
}

SimpleItem is a simple representation of a database item.

func (*SimpleItem) Item

func (i *SimpleItem) Item(j int) Item

Item implements the ItemList interface

func (*SimpleItem) Key

func (i *SimpleItem) Key() []byte

Key implements Item interface.

func (*SimpleItem) Len

func (i *SimpleItem) Len() int

Len implements the ItemList interface

func (*SimpleItem) Val

func (i *SimpleItem) Val() []byte

Val implements the Item interface.

type SimpleItemList

type SimpleItemList []*SimpleItem

SimpleItemList is an ItemList

func (SimpleItemList) Item

func (items SimpleItemList) Item(i int) Item

Item implements the ItemList interface.

func (SimpleItemList) Len

func (items SimpleItemList) Len() int

Len implements the ItemList interface.

Jump to

Keyboard shortcuts

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