context

package
v0.0.0-...-e7ae2a8 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorContextNotFound = errors.New("unable to find specified context")
	ErrorKeyNotFound     = errors.New("unable to find the specified key")
	ErrorInvalidKey      = errors.New("invalid key specified.  Key can not be empty")
	ErrorInvalidValue    = errors.New("invalid value specified.  Value can not be nil")
)
View Source
var DefaultDBOpenFunc = db.Open
View Source
var ErrorExpected = errors.New("expected error")

Functions

func MockClear

func MockClear()

func MockOpen

func MockOpen() (db.Store, error)

Types

type APIContext

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

func (APIContext) DeleteHostData

func (c APIContext) DeleteHostData(hostKey string) error

func (APIContext) HostData

func (c APIContext) HostData(hostKey string, value interface{}) error

func (APIContext) ModuleContext

func (c APIContext) ModuleContext() (string, error)

func (APIContext) SetHostData

func (c APIContext) SetHostData(hostKey string, value interface{}) error

func (APIContext) SetModuleContext

func (c APIContext) SetModuleContext(value string) error

type Context

type Context interface {
	ModuleContext() (string, error)
	SetModuleContext(value string) error
	HostData(hostKey string, value interface{}) error
	SetHostData(hostKey string, data interface{}) error
	DeleteHostData(hostKey string) error
}

func New

func New(contextKey string) Context

func NewWithDB

func NewWithDB(contextKey string, dbOpen DBOpenFunc) Context

type DBOpenFunc

type DBOpenFunc func() (db.Store, error)

type MockStore

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

func (*MockStore) Close

func (ms *MockStore) Close() error

func (*MockStore) Delete

func (ms *MockStore) Delete(key string) error

func (*MockStore) Get

func (ms *MockStore) Get(key string, value interface{}) error

func (*MockStore) Put

func (ms *MockStore) Put(key string, value interface{}) error

Jump to

Keyboard shortcuts

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