TestFreelistType is used as a env variable for test to indicate the backend type
const TestFreelistType = "TEST_FREELIST_TYPE"
DB is a test wrapper for bolt.DB.
type DB struct { *bolt.DB // contains filtered or unexported fields }
func MustCreateDB(t testing.TB) *DB
MustCreateDB returns a new, open DB at a temporary location.
func MustCreateDBWithOption(t testing.TB, o *bolt.Options) *DB
MustCreateDBWithOption returns a new, open DB at a temporary location with given options.
func MustOpenDBWithOption(t testing.TB, f string, o *bolt.Options) *DB
func (db *DB) Close() error
Close closes the database but does NOT delete the underlying file.
func (db *DB) CopyTempFile()
CopyTempFile copies a database to a temporary file.
func (db *DB) Fill(bucket []byte, numTx int, numKeysPerTx int, keyGen func(tx int, key int) []byte, valueGen func(tx int, key int) []byte) error
Fill - fills the DB using numTx transactions and numKeysPerTx.
func (db *DB) MustCheck()
MustCheck runs a consistency check on the database and panics if any errors are found.
func (db *DB) MustClose()
MustClose closes the database but does NOT delete the underlying file.
func (db *DB) MustDeleteFile()
func (db *DB) MustReopen()
MustReopen reopen the database. Panic on error.
func (db *DB) Path() string
func (db *DB) PostTestCleanup()
func (db *DB) PrintStats()
PrintStats prints the database stats
func (db *DB) SetOptions(o *bolt.Options)