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

Function pathSections

http/codegen/paths.go:39–60  ·  view source on GitHub ↗

pathSections returns the sections of the file of the pkg package that contains the request path constructors for the given service.

(svc *expr.HTTPServiceExpr, pkg string, services *ServicesData)

Source from the content-addressed store, hash-verified

37// pathSections returns the sections of the file of the pkg package that
38// contains the request path constructors for the given service.
39func pathSections(svc *expr.HTTPServiceExpr, pkg string, services *ServicesData) []*codegen.SectionTemplate {
40 title := fmt.Sprintf("HTTP request path constructors for the %s service.", svc.Name())
41 sections := make([]*codegen.SectionTemplate, 0, 1+len(svc.HTTPEndpoints))
42 sections = append(sections,
43 codegen.Header(title, pkg, []*codegen.ImportSpec{
44 {Path: "fmt"},
45 {Path: "net/url"},
46 {Path: "strconv"},
47 {Path: "strings"},
48 }),
49 )
50 sdata := services.Get(svc.Name())
51 for _, e := range svc.HTTPEndpoints {
52 sections = append(sections, &codegen.SectionTemplate{
53 Name: "path",
54 Source: httpTemplates.Read(pathT),
55 Data: sdata.Endpoint(e.Name()),
56 })
57 }
58
59 return sections
60}

Callers 2

serverPathFunction · 0.85
clientPathFunction · 0.85

Calls 5

HeaderFunction · 0.92
NameMethod · 0.65
GetMethod · 0.45
ReadMethod · 0.45
EndpointMethod · 0.45

Tested by

no test coverage detected