mocks

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

DB implements a mock DB

func (*DB) DeleteExpiredKeys

func (m *DB) DeleteExpiredKeys() error

DeleteExpiredKeys currently does nothing

func (*DB) Get

func (m *DB) Get(key string) (*api.Value, error)

Get retrieves the value for the given key

func (*DB) GetMultiple

func (m *DB) GetMultiple(keys ...string) ([]*api.Value, error)

GetMultiple retrieves multiple keys at once

func (*DB) Put

func (m *DB) Put(keyVals ...*api.KeyValue) error

Put sets the given values

func (*DB) Query

func (m *DB) Query(query string) ([]*api.KeyValue, error)

Query executes a mock query and returns the key/value result set

func (*DB) WithError

func (m *DB) WithError(err error) *DB

WithError simulates an error on the DB

func (*DB) WithQueryResults

func (m *DB) WithQueryResults(query string, results []*api.KeyValue) *DB

WithQueryResults sets the mock query results for the given query string

func (*DB) WithValue

func (m *DB) WithValue(key string, value *api.Value) *DB

WithValue sets a value for the given key

type DBProvider

type DBProvider struct {
	// contains filtered or unexported fields
}

DBProvider is a mock DB provider

func NewDBProvider

func NewDBProvider() *DBProvider

NewDBProvider returns a new mock DB provider

func (*DBProvider) Close

func (m *DBProvider) Close()

Close currently does nothing

func (*DBProvider) GetDB

func (m *DBProvider) GetDB(channelID string, coll string, ns string) (api.DB, error)

GetDB returns a mock DB for the given namespace/collection

func (*DBProvider) MockDB

func (m *DBProvider) MockDB(ns, coll string) *DB

MockDB is a mock database

func (*DBProvider) WithError

func (m *DBProvider) WithError(err error) *DBProvider

WithError simulates an error on the provider

func (*DBProvider) WithQueryResults

func (m *DBProvider) WithQueryResults(ns, coll, query string, results []*api.KeyValue) *DBProvider

WithQueryResults sets the mock query results for the given query string

func (*DBProvider) WithValue

func (m *DBProvider) WithValue(ns, coll, key string, value *api.Value) *DBProvider

WithValue sets a value for the given key

Jump to

Keyboard shortcuts

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