Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrFilePathIsNotUnderConfigPath = errors.New("File path is not under config path")
View Source
var ErrInvalidMockDefinition = errors.New("Invalid mock config")
ErrInvalidMockDefinition the file contains an invalid mock config
View Source
var ErrMockDoesntExist = errors.New("Definition doesn't exist")
View Source
var ErrNotValidParserFound = errors.New("Not valid config reader found")
ErrNotValidParserFound we don't have any config reader valid for this file
Functions ¶
This section is empty.
Types ¶
type ConfigMapping ¶
func NewConfigMapping ¶
func NewConfigMapping(path string, mapper *FSMapper, fsUpdate chan struct{}) *ConfigMapping
func (*ConfigMapping) Delete ¶
func (fm *ConfigMapping) Delete(URI string) error
func (*ConfigMapping) Get ¶
func (fm *ConfigMapping) Get(URI string) (mock.Definition, bool)
func (*ConfigMapping) List ¶
func (fm *ConfigMapping) List() []mock.Definition
func (*ConfigMapping) Set ¶
func (fm *ConfigMapping) Set(URI string, mock mock.Definition) error
type FSMapper ¶
type FSMapper struct {
// contains filtered or unexported fields
}
FSMapper this struct contains the path of config and some config readers
func NewFileSystemMapper ¶
func NewFileSystemMapper() *FSMapper
NewFileSystemMapper file config constructor
type FileWatcher ¶
type FileWatcher struct {
// contains filtered or unexported fields
}
func NewFileWatcher ¶
func NewFileWatcher(path string, fsUpdate chan struct{}) *FileWatcher
func (*FileWatcher) Bind ¶
func (fw *FileWatcher) Bind()
Bind start the watching process to detect any change on defintions
func (*FileWatcher) UnBind ¶
func (fw *FileWatcher) UnBind()
type Mapping ¶
type Mapping interface { Set(URI string, mock mock.Definition) error Delete(URI string) error Get(URI string) (mock.Definition, bool) List() []mock.Definition }
type Parser ¶
type Parser interface { CanParse(filename string) bool Parse(content []byte) (mock.Definition, error) }
Parser interface allows recognize if there is available some config reader for an a specific file.
type PrioritySort ¶
type PrioritySort []mock.Definition
PrioritySort mock array sorted by priority
func (PrioritySort) Len ¶
func (s PrioritySort) Len() int
func (PrioritySort) Less ¶
func (s PrioritySort) Less(i, j int) bool
func (PrioritySort) Swap ¶
func (s PrioritySort) Swap(i, j int)
type Reader ¶
type Reader interface {
Read(string) (mock.Definition, error)
}
Reader interface contains the funtions to obtain the mock defintions.
Click to show internal directories.
Click to hide internal directories.