package enum type ScheduledType int const ( DRAFT ScheduledType = iota SCHEDULED STARTED FAILURE SUCCESS FORGOTTEN DELAYED CANCELLED ) var str = [...]string{ "draft", "scheduled", "started", "failure", "success", "forgotten", "delayed", "cancelled", } func FromInt(i int) string { return str[i] } func (d ScheduledType) String() string { return str[d] } // EnumIndex - Creating common behavior - give the type a EnumIndex functio func (d ScheduledType) EnumIndex() int { return int(d) } // List func ScheduleList() []ScheduledType { return []ScheduledType{DRAFT, SCHEDULED, STARTED, FAILURE, SUCCESS, FORGOTTEN, DELAYED, CANCELLED} }