byEnum returns a random selected enum value.
(a *AttributeExpr, r *ExampleGenerator)
| 183 | |
| 184 | // byEnum returns a random selected enum value. |
| 185 | func byEnum(a *AttributeExpr, r *ExampleGenerator) any { |
| 186 | if !hasEnumValidation(a) { |
| 187 | return nil |
| 188 | } |
| 189 | values := a.Validation.Values |
| 190 | count := len(values) |
| 191 | i := r.Int() % count |
| 192 | return values[i] |
| 193 | } |
| 194 | |
| 195 | // byFormat returns a random example based on the format the user asks. |
| 196 | func byFormat(a *AttributeExpr, r *ExampleGenerator) any { |
no test coverage detected