A Go tool to auto generate methods for your enums
Go to file
alvaroloes 791bddaf9e Fixed markdown format 2015-12-29 13:29:35 +00:00
testdata Added a method to the generated code to get the enum value from the string name. Fixed all tests. 2015-12-29 13:14:54 +00:00
README.md Fixed markdown format 2015-12-29 13:29:35 +00:00
endtoend_test.go Added a method to the generated code to get the enum value from the string name. Fixed all tests. 2015-12-29 13:14:54 +00:00
enumer.go Added a method to the generated code to get the enum value from the string name. Fixed all tests. 2015-12-29 13:14:54 +00:00
golden_test.go Added a method to the generated code to get the enum value from the string name. Fixed all tests. 2015-12-29 13:14:54 +00:00
stringer.go Added a method to the generated code to get the enum value from the string name. Fixed all tests. 2015-12-29 13:14:54 +00:00
util_test.go Added a method to the generated code to get the enum value from the string name. Fixed all tests. 2015-12-29 13:14:54 +00:00

README.md

#Enumer

Enumer generates Go code to get string names from enum values and viceversa. It is a fork of Rob Pikes 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