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

Method Example

expr/types.go:651–656  ·  view source on GitHub ↗

Example returns a random example value.

(r *ExampleGenerator)

Source from the content-addressed store, hash-verified

649
650// Example returns a random example value.
651func (u *Union) Example(r *ExampleGenerator) any {
652 if len(u.Values) == 0 {
653 return nil
654 }
655 return u.Values[r.Int()%len(u.Values)].Attribute.Example(r)
656}
657
658// GetTypeKey returns the discriminator field name for JSON marshaling.
659// Defaults to "type" if not explicitly set via Meta("oneof:type:field").

Callers

nothing calls this directly

Calls 2

ExampleMethod · 0.65
IntMethod · 0.65

Tested by

no test coverage detected