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

Function Field

dsl/attribute.go:193–203  ·  view source on GitHub ↗

Field is syntactic sugar to define an attribute that defines a tag, e.g. for protobuf. The result is the same as calling Attribute with the "rpc:tag" meta set with the value of the first argument. Field can appear wherever Attribute can. Field takes the same arguments as Attribute with the additi

(tag any, name string, args ...any)

Source from the content-addressed store, hash-verified

191// Pattern("[0-9]+")
192// })
193func Field(tag any, name string, args ...any) {
194 fn := func() { Meta("rpc:tag", fmt.Sprintf("%v", tag)) }
195 if len(args) > 0 {
196 if d, ok := args[len(args)-1].(func()); ok {
197 old := fn
198 fn = func() { d(); old() }
199 args = args[:len(args)-1]
200 }
201 }
202 Attribute(name, append(args, fn)...)
203}
204
205// OneOf creates a union type from a name and a list of attributes.
206//

Callers 15

endpoint_dsls.goFile · 0.85
dsls.goFile · 0.85
TestTooManyArgErrorFunction · 0.85
ErrorNameFunction · 0.85
UsernameFieldFunction · 0.85
PasswordFieldFunction · 0.85
APIKeyFieldFunction · 0.85
AccessTokenFieldFunction · 0.85
BearerTokenFieldFunction · 0.85
TokenFieldFunction · 0.85

Calls 2

MetaFunction · 0.85
AttributeFunction · 0.85

Tested by 1

TestTooManyArgErrorFunction · 0.68