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