Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add function to return all valid enum values #1003

Closed
ernado opened this issue Aug 11, 2023 · 0 comments · Fixed by #1034
Closed

feat: add function to return all valid enum values #1003

ernado opened this issue Aug 11, 2023 · 0 comments · Fixed by #1034
Labels
area: gen Generator issues enhancement New feature or request

Comments

@ernado
Copy link
Member

ernado commented Aug 11, 2023

// Measurement unit.
type SemanticsUnit string

const (
	SemanticsUnitBytes          SemanticsUnit = "bytes"
	SemanticsUnitSeconds        SemanticsUnit = "seconds"
	SemanticsUnitMilliseconds   SemanticsUnit = "milliseconds"
	SemanticsUnitMicroseconds   SemanticsUnit = "microseconds"
	SemanticsUnitNanoseconds    SemanticsUnit = "nanoseconds"
	SemanticsUnitBytesPerSecond SemanticsUnit = "bytes per second"
	SemanticsUnitHertz          SemanticsUnit = "hertz"
)
unit:
  type: string
  description: Measurement unit
  enum:
    - bytes
    - seconds
    - milliseconds
    - microseconds
    - nanoseconds
    - bytes per second
    - hertz

Something like that:

func AllSemanticsUnitValues() []SemanticsUnit {
    return []SemanticsUnit{
        SemanticsUnitHertz,
        // ...
    }

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: gen Generator issues enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant