testdb

package
v0.0.0-...-a579f18 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2016 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

An in-memory database for testing

This database is completely in memory and can be used as a reference for your own implementation.

Since it has rather high memory use, it is not recommended to be used in production. For a good in-memory database, see the bloom driver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemDB

type MemDB map[string]struct{}

This is the simplest possible database that must be supported. If you can mimmic this with your database you are good to go!

func NewMemDB

func NewMemDB() *MemDB

NewMemDB creates a new MemDB instance

func (*MemDB) Add

func (m *MemDB) Add(s string) error

Add a password to the MemDB. It must silently ignore duplicates If an error is returned Import is aborted.

func (MemDB) Has

func (m MemDB) Has(s string) (bool, error)

Has will check if the database has a specific password. If any error is returned, it will be forwarded to your "Check()" call.

type MemDBBulk

type MemDBBulk map[string]struct{}

MemDBBulk is the same as MemDB, but also satisfies the bulk interface.

func NewMemDBBulk

func NewMemDBBulk() *MemDBBulk

NewMemDBBulk will return a new MemDBBulk

func (*MemDBBulk) Add

func (m *MemDBBulk) Add(s string) error

Add a single entry

func (*MemDBBulk) AddMultiple

func (m *MemDBBulk) AddMultiple(s []string) error

AddMultiple is the function that will be called with several items at once.

func (MemDBBulk) Has

func (m MemDBBulk) Has(s string) (bool, error)

Has returns true if the map has the string

Jump to

Keyboard shortcuts

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