Documentation ¶
Index ¶
- type Database
- func (db *Database) Close() error
- func (db *Database) Compact(start []byte, limit []byte) error
- func (db *Database) Delete(k []byte) error
- func (db *Database) Get(k []byte) ([]byte, error)
- func (db *Database) Has(k []byte) (bool, error)
- func (db *Database) NewBatch() database.Batch
- func (db *Database) NewIterator() database.Iterator
- func (db *Database) NewIteratorWithPrefix(prefix []byte) database.Iterator
- func (db *Database) NewIteratorWithStart(start []byte) database.Iterator
- func (db *Database) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator
- func (db *Database) Put(k, v []byte) error
- func (db *Database) Stat(stat string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct { // Executed when Has is called OnHas func([]byte) (bool, error) OnGet func([]byte) ([]byte, error) OnPut func([]byte, []byte) error OnDelete func([]byte) error OnNewBatch func() database.Batch OnNewIterator func() database.Iterator OnNewIteratorWithStart func([]byte) database.Iterator OnNewIteratorWithPrefix func([]byte) database.Iterator OnNewIteratorWithStartAndPrefix func([]byte, []byte) database.Iterator OnStat func(string) (string, error) OnCompact func([]byte, []byte) error OnClose func() error }
Database implements database.Database. This is a mock database meant to be used in tests. You specify the database's return value(s) for a given method call by assign value to the corresponding member. For example, to specify what should happen when Has is called, assign a value to OnHas. If no value is assigned to the corresponding member, the method returns an error or nil If you
func (*Database) NewIterator ¶
NewIterator implements the database.Database interface
func (*Database) NewIteratorWithPrefix ¶
NewIteratorWithPrefix implements the database.Database interface
func (*Database) NewIteratorWithStart ¶
NewIteratorWithStart implements the database.Database interface
func (*Database) NewIteratorWithStartAndPrefix ¶
NewIteratorWithStartAndPrefix implements the database.Database interface