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) HealthCheck() (interface{}, 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
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 OnCompact func([]byte, []byte) error OnClose func() error OnHealthCheck func() (interface{}, error) }
Database 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) HealthCheck ¶
func (*Database) NewIterator ¶
func (*Database) NewIteratorWithPrefix ¶
func (*Database) NewIteratorWithStart ¶
func (*Database) NewIteratorWithStartAndPrefix ¶
Click to show internal directories.
Click to hide internal directories.