Documentation ¶
Index ¶
- Variables
- func Adaptors() map[string]Adaptor
- func Add(name string, creator Creator)
- func MockConfirmWrites() (chan struct{}, func() bool)
- func RegisteredAdaptors() []string
- func VerifyWriteConfirmed(f func() bool, t *testing.T)
- type Adaptor
- type BaseConfig
- type Config
- type Connectable
- type Creator
- type Describable
- type ErrFuncNotSupported
- type ErrNotFound
- type Mock
- type MockClientErr
- type MockWriterErr
- type UnsupportedMock
Constants ¶
This section is empty.
Variables ¶
var ErrNamespaceMalformed = errors.New("malformed namespace, expected a '.' deliminated string")
ErrNamespaceMalformed represents the error to be returned when an invalid namespace is given.
Functions ¶
func Adaptors ¶
Adaptors returns an non-initialized adaptor and is best used for doing assertions to see if the Adaptor supports other interfaces
func MockConfirmWrites ¶ added in v0.4.0
func MockConfirmWrites() (chan struct{}, func() bool)
MockConfirmWrites is a helper function for tests needing a confirms chan.
func RegisteredAdaptors ¶ added in v0.3.0
func RegisteredAdaptors() []string
RegisteredAdaptors returns a slice of the names of every adaptor registered.
func VerifyWriteConfirmed ¶ added in v0.4.0
VerifyWriteConfirmed is a helper function to be used in conjunction with MockConfirmWrites.
Types ¶
type Adaptor ¶
type Adaptor interface { Client() (client.Client, error) Reader() (client.Reader, error) Writer(chan struct{}, *sync.WaitGroup) (client.Writer, error) }
Adaptor defines the interface which provides functions to create client interfaces
type BaseConfig ¶ added in v0.3.0
BaseConfig is a standard typed config struct to use for as general purpose config for most databases.
type Config ¶
type Config map[string]interface{}
Config is an alias to map[string]interface{} and helps us turn a fuzzy document into a conrete named struct
type Connectable ¶
type Connectable interface {
Connect() error
}
Connectable defines the interface that adapters should follow to have their connections set on load Connect() allows the adaptor an opportunity to setup connections prior to Start()
type Describable ¶
Describable defines the interface that all database connectors and nodes must follow in order to support the help functions. SampleConfig() returns an example JSON structure to configure the adaptor Description() provides contextual information for what the adaptor is for
type ErrFuncNotSupported ¶ added in v0.3.0
ErrFuncNotSupported should be used for adaptors that do not support a given function defined by the interface.
func (ErrFuncNotSupported) Error ¶ added in v0.3.0
func (a ErrFuncNotSupported) Error() string
type ErrNotFound ¶
type ErrNotFound struct {
Name string
}
ErrNotFound gives the details of the failed adaptor
func (ErrNotFound) Error ¶
func (a ErrNotFound) Error() string
type Mock ¶ added in v0.3.0
type Mock struct {
BaseConfig
}
Mock can be used for mocking tests that need no functional client interfaces.
func (*Mock) Client ¶ added in v0.3.0
Client satisfies the V2 interface for providing a client.Client.
type MockClientErr ¶ added in v0.4.0
type MockClientErr struct {
BaseConfig
}
MockClientErr can be used to to mock client.Client() errors.
func (*MockClientErr) Client ¶ added in v0.4.0
func (m *MockClientErr) Client() (client.Client, error)
Client satisfies the client.Client interface.
type MockWriterErr ¶ added in v0.4.0
type MockWriterErr struct {
BaseConfig
}
MockWriterErr can be used to to mock client.Write() errors.
func (*MockWriterErr) Client ¶ added in v0.4.0
func (m *MockWriterErr) Client() (client.Client, error)
Client satisfies the client.Client interface.
type UnsupportedMock ¶ added in v0.3.0
type UnsupportedMock struct {
BaseConfig
}
UnsupportedMock can be used for mocking tests that need no functional client interfaces.
func (*UnsupportedMock) Client ¶ added in v0.3.0
func (m *UnsupportedMock) Client() (client.Client, error)
Client satisfies the V2 interface for providing a client.Client.