rename 'implement' into 'response'

This commit is contained in:
Adrien Marquès 2018-07-09 00:15:29 +02:00
parent 6784c2df95
commit 07bbdbbe30
7 changed files with 14 additions and 14 deletions

View File

@ -116,7 +116,7 @@ Each middleware must be directly inside the `middleware` folder.
##### 4. Custom types
In your configuration you will have to use built-in types (*e.g.* int, any, varchar), but if you want project-specific ones, you can add your own types inside the `type` folder. You can check what structure to follow by looking at the [built-in types](https://git.xdrm.io/go/aicra/src/master/checker/default).
In your configuration you will have to use built-in types (*e.g.* int, any, varchar), but if you want project-specific ones, you can add your own types inside the `type` folder. You can check what structure to follow by looking at the [built-in types](https://git.xdrm.io/go/aicra/src/master/internal/checker/default).

View File

@ -3,7 +3,7 @@ package request
import (
"encoding/json"
"fmt"
"git.xdrm.io/go/aicra/implement"
"git.xdrm.io/go/aicra/response"
"log"
"net/http"
"plugin"
@ -93,7 +93,7 @@ func FetchFormData(req *http.Request) map[string]interface{} {
// LoadController tries to load a controller from its uri
// checks for its given method ('Get', 'Post', 'Put', or 'Delete')
func (i *Request) LoadController(method string) (func(implement.Arguments, *implement.Response) implement.Response, error) {
func (i *Request) LoadController(method string) (func(response.Arguments, *response.Response) response.Response, error) {
/* (1) Build controller path */
path := strings.Join(i.Path, "-")
@ -121,7 +121,7 @@ func (i *Request) LoadController(method string) (func(implement.Arguments, *impl
}
/* (4) Check signature */
callable, validSignature := m.(func(implement.Arguments, *implement.Response) implement.Response)
callable, validSignature := m.(func(response.Arguments, *response.Response) response.Response)
if !validSignature {
return nil, fmt.Errorf("Invalid signature for method %s", method)
}

View File

@ -1,4 +1,4 @@
package implement
package response
// Checks whether a key exists in the arguments
func (i Arguments) Has(key string) bool {

View File

@ -1,4 +1,4 @@
package implement
package response
import (
"git.xdrm.io/go/aicra/err"

View File

@ -1,4 +1,4 @@
package implement
package response
import (
"git.xdrm.io/go/aicra/err"

View File

@ -3,11 +3,11 @@ package aicra
import (
"fmt"
e "git.xdrm.io/go/aicra/err"
"git.xdrm.io/go/aicra/implement"
"git.xdrm.io/go/aicra/internal/checker"
"git.xdrm.io/go/aicra/internal/config"
"git.xdrm.io/go/aicra/internal/request"
"git.xdrm.io/go/aicra/middleware"
"git.xdrm.io/go/aicra/response"
"log"
"net/http"
)
@ -124,7 +124,7 @@ func (s *Server) routeRequest(res http.ResponseWriter, httpReq *http.Request) {
parameters["_SCOPE_"] = scope
/* (3) Execute */
response := callable(parameters, implement.NewResponse())
response := callable(parameters, response.NewResponse())
/* (4) Extract http headers */
for k, v := range response.Dump() {

View File

@ -3,9 +3,9 @@ package aicra
import (
"encoding/json"
"git.xdrm.io/go/aicra/err"
"git.xdrm.io/go/aicra/implement"
"git.xdrm.io/go/aicra/internal/config"
"git.xdrm.io/go/aicra/internal/request"
"git.xdrm.io/go/aicra/response"
"log"
"net/http"
)
@ -34,7 +34,7 @@ func httpRedirect(r http.ResponseWriter, loc string) {
}
// Prints an HTTP response
func httpPrint(r http.ResponseWriter, res implement.Response) {
func httpPrint(r http.ResponseWriter, res response.Response) {
// get response data
formattedResponse := res.Dump()