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

Function Value

dsl/value.go:23–33  ·  view source on GitHub ↗

Value sets the example value. Value must appear in Example. Value takes one argument: the example value. Example: Example("A simple bottle", func() { Description("This bottle has an ID set to 1") Value(Val{"ID": 1}) })

(val any)

Source from the content-addressed store, hash-verified

21// Value(Val{"ID": 1})
22// })
23func Value(val any) {
24 switch e := eval.Current().(type) {
25 case *expr.ExampleExpr:
26 if v, ok := val.(expr.Val); ok {
27 val = map[string]any(v)
28 }
29 e.Value = val
30 default:
31 eval.IncompatibleDSL()
32 }
33}

Callers 2

type_spec_test.goFile · 0.85

Calls 2

CurrentFunction · 0.92
IncompatibleDSLFunction · 0.92

Tested by

no test coverage detected