MCPcopy Create free account
hub / github.com/goadesign/goa / requestInitTemplate

Function requestInitTemplate

http/codegen/service_data.go:1003–1018  ·  view source on GitHub ↗

requestInitTemplate returns the template used to render request constructors.

(svcData *ServiceData)

Source from the content-addressed store, hash-verified

1001
1002// requestInitTemplate returns the template used to render request constructors.
1003func requestInitTemplate(svcData *ServiceData) *template.Template {
1004 return template.Must(
1005 template.New("request-init").
1006 Funcs(template.FuncMap{
1007 "goTypeRef": func(dt expr.DataType, svc string) string {
1008 return svcData.Scope.GoTypeRef(&expr.AttributeExpr{Type: dt})
1009 },
1010 "isAliased": func(dt expr.DataType) bool {
1011 _, ok := dt.(expr.UserType)
1012 return ok
1013 },
1014 "isWebSocketEndpoint": IsWebSocketEndpoint,
1015 }).
1016 Parse(httpTemplates.Read(requestInitT)),
1017 )
1018}
1019
1020// makeHTTPType traverses the attribute recursively and performs these actions:
1021//

Callers 1

analyzeMethod · 0.85

Calls 2

GoTypeRefMethod · 0.80
ReadMethod · 0.45

Tested by

no test coverage detected