NewFlagData creates a new FlagData from the given argument attributes. svcn is the service name en is the endpoint name name is the flag name typeName is the flag type description is the flag description required determines if the flag is required example is an example value for the flag
(svcn, en, name, typeName, description string, required bool, example, def any)
| 332 | // required determines if the flag is required |
| 333 | // example is an example value for the flag |
| 334 | func NewFlagData(svcn, en, name, typeName, description string, required bool, example, def any) *FlagData { |
| 335 | ex := jsonExample(example) |
| 336 | fn := goifyTerms(svcn, en, name) |
| 337 | return &FlagData{ |
| 338 | Name: codegen.KebabCase(name), |
| 339 | VarName: codegen.Goify(name, false), |
| 340 | Type: flagType(typeName), |
| 341 | FullName: fn, |
| 342 | Description: description, |
| 343 | Required: required, |
| 344 | Example: ex, |
| 345 | Default: def, |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | // FieldLoadCode returns the code used in the build payload function that |
| 350 | // initializes one of the payload object fields. It returns the initialization |
no test coverage detected