// Code generated by "enumer -type ProjectGrantState -transform lower -trimprefix ProjectGrantState -sql"; DO NOT EDIT. package domain import ( "database/sql/driver" "fmt" "strings" ) const _ProjectGrantStateName = "activeinactive" var _ProjectGrantStateIndex = [...]uint8{0, 6, 14} const _ProjectGrantStateLowerName = "activeinactive" func (i ProjectGrantState) String() string { if i >= ProjectGrantState(len(_ProjectGrantStateIndex)-1) { return fmt.Sprintf("ProjectGrantState(%d)", i) } return _ProjectGrantStateName[_ProjectGrantStateIndex[i]:_ProjectGrantStateIndex[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 _ProjectGrantStateNoOp() { var x [1]struct{} _ = x[ProjectGrantStateActive-(0)] _ = x[ProjectGrantStateInactive-(1)] } var _ProjectGrantStateValues = []ProjectGrantState{ProjectGrantStateActive, ProjectGrantStateInactive} var _ProjectGrantStateNameToValueMap = map[string]ProjectGrantState{ _ProjectGrantStateName[0:6]: ProjectGrantStateActive, _ProjectGrantStateLowerName[0:6]: ProjectGrantStateActive, _ProjectGrantStateName[6:14]: ProjectGrantStateInactive, _ProjectGrantStateLowerName[6:14]: ProjectGrantStateInactive, } var _ProjectGrantStateNames = []string{ _ProjectGrantStateName[0:6], _ProjectGrantStateName[6:14], } // ProjectGrantStateString retrieves an enum value from the enum constants string name. // Throws an error if the param is not part of the enum. func ProjectGrantStateString(s string) (ProjectGrantState, error) { if val, ok := _ProjectGrantStateNameToValueMap[s]; ok { return val, nil } if val, ok := _ProjectGrantStateNameToValueMap[strings.ToLower(s)]; ok { return val, nil } return 0, fmt.Errorf("%s does not belong to ProjectGrantState values", s) } // ProjectGrantStateValues returns all values of the enum func ProjectGrantStateValues() []ProjectGrantState { return _ProjectGrantStateValues } // ProjectGrantStateStrings returns a slice of all String values of the enum func ProjectGrantStateStrings() []string { strs := make([]string, len(_ProjectGrantStateNames)) copy(strs, _ProjectGrantStateNames) return strs } // IsAProjectGrantState returns "true" if the value is listed in the enum definition. "false" otherwise func (i ProjectGrantState) IsAProjectGrantState() bool { for _, v := range _ProjectGrantStateValues { if i == v { return true } } return false } func (i ProjectGrantState) Value() (driver.Value, error) { return i.String(), nil } func (i *ProjectGrantState) Scan(value interface{}) error { if value == nil { return nil } var str string switch v := value.(type) { case []byte: str = string(v) case string: str = v case fmt.Stringer: str = v.String() default: return fmt.Errorf("invalid value of ProjectGrantState: %[1]T(%[1]v)", value) } val, err := ProjectGrantStateString(str) if err != nil { return err } *i = val return nil }