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

Method Example

expr/types.go:420–431  ·  view source on GitHub ↗

Example generates a pseudo-random array value using the given random generator.

(r *ExampleGenerator)

Source from the content-addressed store, hash-verified

418// Example generates a pseudo-random array value using the given random
419// generator.
420func (a *Array) Example(r *ExampleGenerator) any {
421 count := NewLength(a.ElemType, r)
422 res := make([]any, count)
423 for i := range count {
424 res[i] = a.ElemType.Example(r)
425 if res[i] == nil {
426 // Handle the case of recursive data structures
427 res[i] = make(map[string]any)
428 }
429 }
430 return a.MakeSlice(res)
431}
432
433// MakeSlice examines the key type from the Array and create a slice with
434// builtin type if possible. The idea is to avoid generating []any and

Callers

nothing calls this directly

Calls 3

MakeSliceMethod · 0.95
NewLengthFunction · 0.85
ExampleMethod · 0.65

Tested by

no test coverage detected