// Code generated by "enumer -type OrgState -transform lower -trimprefix OrgState -sql"; DO NOT EDIT. package domain import ( "database/sql/driver" "fmt" "strings" ) const _OrgStateName = "activeinactive" var _OrgStateIndex = [...]uint8{0, 6, 14} const _OrgStateLowerName = "activeinactive" func (i OrgState) String() string { if i >= OrgState(len(_OrgStateIndex)-1) { return fmt.Sprintf("OrgState(%d)", i) } return _OrgStateName[_OrgStateIndex[i]:_OrgStateIndex[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 _OrgStateNoOp() { var x [1]struct{} _ = x[OrgStateActive-(0)] _ = x[OrgStateInactive-(1)] } var _OrgStateValues = []OrgState{OrgStateActive, OrgStateInactive} var _OrgStateNameToValueMap = map[string]OrgState{ _OrgStateName[0:6]: OrgStateActive, _OrgStateLowerName[0:6]: OrgStateActive, _OrgStateName[6:14]: OrgStateInactive, _OrgStateLowerName[6:14]: OrgStateInactive, } var _OrgStateNames = []string{ _OrgStateName[0:6], _OrgStateName[6:14], } // OrgStateString retrieves an enum value from the enum constants string name. // Throws an error if the param is not part of the enum. func OrgStateString(s string) (OrgState, error) { if val, ok := _OrgStateNameToValueMap[s]; ok { return val, nil } if val, ok := _OrgStateNameToValueMap[strings.ToLower(s)]; ok { return val, nil } return 0, fmt.Errorf("%s does not belong to OrgState values", s) } // OrgStateValues returns all values of the enum func OrgStateValues() []OrgState { return _OrgStateValues } // OrgStateStrings returns a slice of all String values of the enum func OrgStateStrings() []string { strs := make([]string, len(_OrgStateNames)) copy(strs, _OrgStateNames) return strs } // IsAOrgState returns "true" if the value is listed in the enum definition. "false" otherwise func (i OrgState) IsAOrgState() bool { for _, v := range _OrgStateValues { if i == v { return true } } return false } func (i OrgState) Value() (driver.Value, error) { return i.String(), nil } func (i *OrgState) 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 OrgState: %[1]T(%[1]v)", value) } val, err := OrgStateString(str) if err != nil { return err } *i = val return nil }