refactor-test #15
|
@ -8,6 +8,12 @@ import (
|
|||
"git.xdrm.io/go/aicra/internal/config"
|
||||
)
|
||||
|
||||
// Handler represents a dynamic api handler
|
||||
type Handler struct {
|
||||
spec spec
|
||||
fn interface{}
|
||||
}
|
||||
|
||||
// Build a handler from a service configuration and a dynamic function
|
||||
//
|
||||
// @fn must have as a signature : `func(inputStruct) (*outputStruct, api.Error)`
|
||||
|
|
|
@ -9,6 +9,11 @@ import (
|
|||
"git.xdrm.io/go/aicra/internal/config"
|
||||
)
|
||||
|
||||
type spec struct {
|
||||
Input map[string]reflect.Type
|
||||
Output map[string]reflect.Type
|
||||
}
|
||||
|
||||
// builds a spec from the configuration service
|
||||
func makeSpec(service config.Service) spec {
|
||||
spec := spec{
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
package dynfunc
|
||||
|
||||
import "reflect"
|
||||
|
||||
// Handler represents a dynamic api handler
|
||||
type Handler struct {
|
||||
spec spec
|
||||
fn interface{}
|
||||
}
|
||||
|
||||
type spec struct {
|
||||
Input map[string]reflect.Type
|
||||
Output map[string]reflect.Type
|
||||
}
|
Loading…
Reference in New Issue