multi fixtures
parent
b7124b259f
commit
e307ce7669
|
@ -223,7 +223,7 @@ func addFunction(a *ast.FuncDecl) {
|
|||
}
|
||||
|
||||
if fn.Path == "" {
|
||||
fn.Path = "/" + strings.ToLower(a.Name.Name)
|
||||
fn.Path = "/" + strings.Replace(strings.ToLower(a.Name.Name), "_", "/", -1)
|
||||
}
|
||||
|
||||
api.Methods[a.Name.Name] = &fn
|
||||
|
|
|
@ -66,8 +66,8 @@ func {{$methodname}}(req {{if $method.ReqType.IsArray}}[]{{end}}{{if $method.Re
|
|||
if err!=nil{
|
||||
return
|
||||
}
|
||||
var ret {{if $method.ResType.IsArray}}[]{{end}}{{if $method.ResType.Ispointer}}*{{end}}{{$method.ResType.Typename}}
|
||||
err = dec.Decode(ret)
|
||||
var ret {{if $method.ResType.IsArray}}[]{{end}}{{if $method.ResType.Ispointer}}*{{end}}{{$method.ResType.Typename}} {{if $method.ResType.Ispointer}} {{if ne $method.ResType.IsArray true}}=&{{$method.ResType.Typename}}{}{{end}}{{end}}
|
||||
err = dec.Decode({{if $method.ResType.IsArray}}&{{end}} {{if ne $method.ResType.Ispointer true}}&{{end}}ret)
|
||||
return ret, err
|
||||
}
|
||||
{{end}}
|
||||
|
|
|
@ -37,6 +37,7 @@ func Build(r *gin.Engine) *gin.Engine {
|
|||
{{- if $verb.Method.ReqType.Ispointer}} *{{ end -}}
|
||||
{{- $verb.Method.ReqType.Typename}}
|
||||
{{- if or $verb.Method.ReqType.IsArray $verb.Method.ReqType.Ispointer}}
|
||||
{{- if $verb.Method.ReqType.Ispointer}} = &{{- $verb.Method.ReqType.Typename}}{}{{ end}}
|
||||
c.BindJSON(req)
|
||||
{{else}}
|
||||
c.BindJSON(&req)
|
||||
|
|
Loading…
Reference in New Issue