// Code generated by "enumer -type ProjectState -transform lower -trimprefix ProjectState -sql"; DO NOT EDIT. package domain import ( "database/sql/driver" "fmt" "strings" ) const _ProjectStateName = "activeinactive" var _ProjectStateIndex = [...]uint8{0, 6, 14} const _ProjectStateLowerName = "activeinactive" func (i ProjectState) String() string { if i >= ProjectState(len(_ProjectStateIndex)-1) { return fmt.Sprintf("ProjectState(%d)", i) } return _ProjectStateName[_ProjectStateIndex[i]:_ProjectStateIndex[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 _ProjectStateNoOp() { var x [1]struct{} _ = x[ProjectStateActive-(0)] _ = x[ProjectStateInactive-(1)] } var _ProjectStateValues = []ProjectState{ProjectStateActive, ProjectStateInactive} var _ProjectStateNameToValueMap = map[string]ProjectState{ _ProjectStateName[0:6]: ProjectStateActive, _ProjectStateLowerName[0:6]: ProjectStateActive, _ProjectStateName[6:14]: ProjectStateInactive, _ProjectStateLowerName[6:14]: ProjectStateInactive, } var _ProjectStateNames = []string{ _ProjectStateName[0:6], _ProjectStateName[6:14], } // ProjectStateString retrieves an enum value from the enum constants string name. // Throws an error if the param is not part of the enum. func ProjectStateString(s string) (ProjectState, error) { if val, ok := _ProjectStateNameToValueMap[s]; ok { return val, nil } if val, ok := _ProjectStateNameToValueMap[strings.ToLower(s)]; ok { return val, nil } return 0, fmt.Errorf("%s does not belong to ProjectState values", s) } // ProjectStateValues returns all values of the enum func ProjectStateValues() []ProjectState { return _ProjectStateValues } // ProjectStateStrings returns a slice of all String values of the enum func ProjectStateStrings() []string { strs := make([]string, len(_ProjectStateNames)) copy(strs, _ProjectStateNames) return strs } // IsAProjectState returns "true" if the value is listed in the enum definition. "false" otherwise func (i ProjectState) IsAProjectState() bool { for _, v := range _ProjectStateValues { if i == v { return true } } return false } func (i ProjectState) Value() (driver.Value, error) { return i.String(), nil } func (i *ProjectState) 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 ProjectState: %[1]T(%[1]v)", value) } val, err := ProjectStateString(str) if err != nil { return err } *i = val return nil }