-
Notifications
You must be signed in to change notification settings - Fork 0
/
custombinderrender_gors.go
40 lines (36 loc) · 1.2 KB
/
custombinderrender_gors.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
31
32
33
34
35
36
37
38
39
40
// Code generated by "gors -service CustomBinderRender"; DO NOT EDIT.
package demo
import (
gin "github.com/gin-gonic/gin"
gors "github.com/go-leo/gors"
http "net/http"
)
func CustomBinderRenderRoutes(srv CustomBinderRender, opts ...gors.Option) []gors.Route {
options := gors.NewOptions(opts...)
return []gors.Route{
gors.NewRoute(http.MethodPost, "/api/CustomBinderRender/Custom", _CustomBinderRender_Custom_Handler(srv, options)),
}
}
func _CustomBinderRender_Custom_Handler(srv CustomBinderRender, options *gors.Options) func(c *gin.Context) {
return func(c *gin.Context) {
var rpcMethodName = "/demo.CustomBinderRender/Custom"
var ctx = gors.NewContext(c, rpcMethodName)
var req *CustomReq
var resp *CustomResp
var err error
req = new(CustomReq)
if err = gors.RequestBind(
ctx, req, options.Tag,
gors.CustomBinding,
); err != nil {
gors.ErrorRender(ctx, err, options.ErrorHandler, options.ResponseWrapper)
return
}
resp, err = srv.Custom(ctx, req)
if err != nil {
gors.ErrorRender(ctx, err, options.ErrorHandler, options.ResponseWrapper)
return
}
gors.ResponseRender(ctx, gors.StatusCode(ctx), resp, "application/custom", gors.CustomRender, options.ResponseWrapper)
}
}