mirror of https://github.com/dmarkham/enumer.git
04512eae0c | ||
---|---|---|
testdata | ||
README.md | ||
endtoend_test.go | ||
enumer.go | ||
golden_test.go | ||
stringer.go | ||
util_test.go |
README.md
#Enumer
Enumer generates Go code to get string names from enum values and viceversa. It is a fork of Rob Pike’s Stringer tool but adding a "string to enum value" method to the generated code.
For example, if we have an enum type called Pill
, executing enumer -type=Pill
will generate two methods:
func (i Pill) String() string {
//...
}
func PillString(s string) (Pill, error) {
//...
}
For more information on how to use, please go to the Stringer docs