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

Function InterceptorsFiles

codegen/service/interceptors.go:11–29  ·  view source on GitHub ↗

InterceptorsFiles returns the interceptors files for the given service.

(_ string, service *expr.ServiceExpr, services *ServicesData)

Source from the content-addressed store, hash-verified

9
10// InterceptorsFiles returns the interceptors files for the given service.
11func InterceptorsFiles(_ string, service *expr.ServiceExpr, services *ServicesData) []*codegen.File {
12 var files []*codegen.File
13 svc := services.Get(service.Name)
14
15 // Generate service-specific interceptor files
16 if len(svc.ServerInterceptors) > 0 {
17 files = append(files, interceptorFile(svc, true))
18 }
19 if len(svc.ClientInterceptors) > 0 {
20 files = append(files, interceptorFile(svc, false))
21 }
22
23 // Generate wrapper file if this service has any interceptors
24 if len(svc.ServerInterceptors) > 0 || len(svc.ClientInterceptors) > 0 {
25 files = append(files, wrapperFile(svc))
26 }
27
28 return files
29}
30
31// interceptorFile returns the file defining the interceptors.
32// This method is called twice, once for the server and once for the client.

Callers 2

FilesFunction · 0.85
TestInterceptorsFunction · 0.85

Calls 3

interceptorFileFunction · 0.85
wrapperFileFunction · 0.85
GetMethod · 0.45

Tested by 1

TestInterceptorsFunction · 0.68