-
Notifications
You must be signed in to change notification settings - Fork 0
/
http.go
31 lines (21 loc) · 956 Bytes
/
http.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package hygienic
import "net/http"
type HTTPRequestDecoder func(Context, *http.Request) (request interface{}, err error)
type HTTPResponseEncoder func(Context, interface{}) (response *HTTPResponse, err error)
type HTTPResponse struct {
Code int `json:"-"` // if Code is status move permanently, kernel will use Result as string to redirect
Result interface{} `json:"result,omitempty"`
Message string `json:"message,omitempty"`
Detail []string `json:"detail,omitempty"`
Debug interface{} `json:"debug,omitempty"`
}
type HTTPRespose_PaginationResult struct {
Count int `json:"count"`
Limit int `json:"limit"`
Offset int `json:"offset"`
Records interface{} `json:"records"`
}
func NewHTTPTransports(endpoints EndpointFunc,reqDec HTTPRequestDecoder, resEnc HTTPResponseEncoder) func(http.ResponseWriter, *http.Request) {
return func(writer http.ResponseWriter, request *http.Request) {
}
}