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

Function params

dsl/http.go:1191–1213  ·  view source on GitHub ↗

params returns the mapped attribute containing the path and query params for the given expression if it's either the root, an API server, a service or an endpoint - nil otherwise.

(exp eval.Expression)

Source from the content-addressed store, hash-verified

1189// the given expression if it's either the root, an API server, a service or an
1190// endpoint - nil otherwise.
1191func params(exp eval.Expression) *expr.MappedAttributeExpr {
1192 switch e := exp.(type) {
1193 case *expr.RootExpr:
1194 if e.API.HTTP.Params == nil {
1195 e.API.HTTP.Params = expr.NewEmptyMappedAttributeExpr()
1196 }
1197 return e.API.HTTP.Params
1198 case *expr.HTTPServiceExpr:
1199 if e.Params == nil {
1200 e.Params = expr.NewEmptyMappedAttributeExpr()
1201 }
1202 return e.Params
1203 case *expr.HTTPEndpointExpr:
1204 if e.Params == nil {
1205 e.Params = expr.NewEmptyMappedAttributeExpr()
1206 }
1207 return e.Params
1208 case *expr.MappedAttributeExpr:
1209 return e
1210 default:
1211 return nil
1212 }
1213}
1214
1215// cookieAttribute initialize the current attribute metadata with the details of
1216// a HTTP cookie attribute for use by the HTTP code generator.

Callers 2

ParamsFunction · 0.85
ParamFunction · 0.85

Calls 1

Tested by

no test coverage detected