unexport driver.generic mockups
This commit is contained in:
parent
b02dc60b3d
commit
ee19846ddc
|
@ -35,17 +35,17 @@ func (d Generic) Compiled() bool { return false }
|
|||
|
||||
// LoadController implements the Driver interface
|
||||
func (d *Generic) LoadController(_path string) (Controller, error) {
|
||||
return GenericController(_path), nil
|
||||
return genericController(_path), nil
|
||||
}
|
||||
|
||||
// LoadMiddleware returns a new middleware; it must be a
|
||||
// valid and existing folder/filename file
|
||||
func (d *Generic) LoadMiddleware(_path string) (Middleware, error) {
|
||||
return GenericMiddleware(_path), nil
|
||||
return genericMiddleware(_path), nil
|
||||
}
|
||||
|
||||
// LoadChecker returns a new middleware; it must be a
|
||||
// valid and existing folder/filename file
|
||||
func (d *Generic) LoadChecker(_path string) (Checker, error) {
|
||||
return GenericChecker(_path), nil
|
||||
return genericChecker(_path), nil
|
||||
}
|
||||
|
|
|
@ -9,10 +9,10 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// GenericController is the mockup for returning a controller with as a string the path
|
||||
type GenericController string
|
||||
// genericController is the mockup for returning a controller with as a string the path
|
||||
type genericController string
|
||||
|
||||
func (path GenericController) Get(d response.Arguments) response.Response {
|
||||
func (path genericController) Get(d response.Arguments) response.Response {
|
||||
|
||||
res := response.New()
|
||||
|
||||
|
@ -67,20 +67,20 @@ func (path GenericController) Get(d response.Arguments) response.Response {
|
|||
|
||||
}
|
||||
|
||||
func (path GenericController) Post(d response.Arguments) response.Response {
|
||||
func (path genericController) Post(d response.Arguments) response.Response {
|
||||
return path.Get(d)
|
||||
}
|
||||
func (path GenericController) Put(d response.Arguments) response.Response {
|
||||
func (path genericController) Put(d response.Arguments) response.Response {
|
||||
return path.Get(d)
|
||||
}
|
||||
func (path GenericController) Delete(d response.Arguments) response.Response {
|
||||
func (path genericController) Delete(d response.Arguments) response.Response {
|
||||
return path.Get(d)
|
||||
}
|
||||
|
||||
// GenericMiddleware is the mockup for returning a middleware as a string (its path)
|
||||
type GenericMiddleware string
|
||||
// genericMiddleware is the mockup for returning a middleware as a string (its path)
|
||||
type genericMiddleware string
|
||||
|
||||
func (path GenericMiddleware) Inspect(_req http.Request, _scope *[]string) {
|
||||
func (path genericMiddleware) Inspect(_req http.Request, _scope *[]string) {
|
||||
|
||||
/* (1) Prepare stdin data */
|
||||
stdin, err := json.Marshal(_scope)
|
||||
|
@ -120,10 +120,10 @@ func (path GenericMiddleware) Inspect(_req http.Request, _scope *[]string) {
|
|||
|
||||
}
|
||||
|
||||
// GenericChecker is the mockup for returning a checker as a string (its path)
|
||||
type GenericChecker string
|
||||
// genericChecker is the mockup for returning a checker as a string (its path)
|
||||
type genericChecker string
|
||||
|
||||
func (path GenericChecker) Match(_type string) bool {
|
||||
func (path genericChecker) Match(_type string) bool {
|
||||
|
||||
/* (1) Try to load command with <stdin> -> stdout */
|
||||
cmd := exec.Command(string(path), _type)
|
||||
|
@ -139,7 +139,7 @@ func (path GenericChecker) Match(_type string) bool {
|
|||
return output == "true" || output == "1"
|
||||
|
||||
}
|
||||
func (path GenericChecker) Check(_value interface{}) bool {
|
||||
func (path genericChecker) Check(_value interface{}) bool {
|
||||
|
||||
/* (1) Prepare stdin data */
|
||||
indata := make(map[string]interface{})
|
||||
|
|
Loading…
Reference in New Issue