You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can generate enums from ordered constants. Each enum variant can have a comment, an override name, or both. This works with both iota-defined and manually defined constants.
906
+
907
+
```go
908
+
type Difficulty string
909
+
910
+
const (
911
+
Easy Difficulty = "easy" // You can add a comment to the enum variant.
912
+
Medium Difficulty = "medium" // @name MediumDifficulty
913
+
Hard Difficulty = "hard" // @name HardDifficulty You can have a name override and a comment.
914
+
)
915
+
916
+
type Class int
917
+
918
+
const (
919
+
First Class = iota // @name FirstClass
920
+
Second // Name override and comment rules apply here just as above.
921
+
Third // @name ThirdClass This one has a name override and a comment.
922
+
)
923
+
924
+
// There is no need to add `enums:"..."` to the fields, it is automatically generated from the ordered consts.
0 commit comments