const _DayName = "NightMondayNightTuesdayNightWednesdayNightThursdayNightFridayNightSaturdayNightSunday" var _DayIndex = [...]uint8{0, 11, 23, 37, 50, 61, 74, 85} const _DayLowerName = "nightmondaynighttuesdaynightwednesdaynightthursdaynightfridaynightsaturdaynightsunday" func (i Day) String() string { if i < 0 || i >= Day(len(_DayIndex)-1) { return fmt.Sprintf("Day(%d)", i) } return _DayName[_DayIndex[i]:_DayIndex[i+1]] } // An "invalid array index" compiler error signifies that the constant values have changed. // Re-run the stringer command to generate them again. func _DayNoOp() { var x [1]struct{} _ = x[DayMonday-(0)] _ = x[DayTuesday-(1)] _ = x[DayWednesday-(2)] _ = x[DayThursday-(3)] _ = x[DayFriday-(4)] _ = x[DaySaturday-(5)] _ = x[DaySunday-(6)] } var _DayValues = []Day{DayMonday, DayTuesday, DayWednesday, DayThursday, DayFriday, DaySaturday, DaySunday} var _DayNameToValueMap = map[string]Day{ _DayName[0:11]: DayMonday, _DayLowerName[0:11]: DayMonday, _DayName[11:23]: DayTuesday, _DayLowerName[11:23]: DayTuesday, _DayName[23:37]: DayWednesday, _DayLowerName[23:37]: DayWednesday, _DayName[37:50]: DayThursday, _DayLowerName[37:50]: DayThursday, _DayName[50:61]: DayFriday, _DayLowerName[50:61]: DayFriday, _DayName[61:74]: DaySaturday, _DayLowerName[61:74]: DaySaturday, _DayName[74:85]: DaySunday, _DayLowerName[74:85]: DaySunday, } var _DayNames = []string{ _DayName[0:11], _DayName[11:23], _DayName[23:37], _DayName[37:50], _DayName[50:61], _DayName[61:74], _DayName[74:85], } // DayString retrieves an enum value from the enum constants string name. // Throws an error if the param is not part of the enum. func DayString(s string) (Day, error) { if val, ok := _DayNameToValueMap[s]; ok { return val, nil } if val, ok := _DayNameToValueMap[strings.ToLower(s)]; ok { return val, nil } return 0, fmt.Errorf("%s does not belong to Day values", s) } // DayValues returns all values of the enum func DayValues() []Day { return _DayValues } // DayStrings returns a slice of all String values of the enum func DayStrings() []string { strs := make([]string, len(_DayNames)) copy(strs, _DayNames) return strs } // IsADay returns "true" if the value is listed in the enum definition. "false" otherwise func (i Day) IsADay() bool { for _, v := range _DayValues { if i == v { return true } } return false }