github.com/hashicorp/vault/sdk@v0.13.0/database/helper/credsutil/caseop_enumer.go (about) 1 // Code generated by "enumer -type=CaseOp -transform=snake"; DO NOT EDIT. 2 3 package credsutil 4 5 import ( 6 "fmt" 7 ) 8 9 const _CaseOpName = "keep_caseuppercaselowercase" 10 11 var _CaseOpIndex = [...]uint8{0, 9, 18, 27} 12 13 func (i CaseOp) String() string { 14 if i < 0 || i >= CaseOp(len(_CaseOpIndex)-1) { 15 return fmt.Sprintf("CaseOp(%d)", i) 16 } 17 return _CaseOpName[_CaseOpIndex[i]:_CaseOpIndex[i+1]] 18 } 19 20 var _CaseOpValues = []CaseOp{0, 1, 2} 21 22 var _CaseOpNameToValueMap = map[string]CaseOp{ 23 _CaseOpName[0:9]: 0, 24 _CaseOpName[9:18]: 1, 25 _CaseOpName[18:27]: 2, 26 } 27 28 // CaseOpString retrieves an enum value from the enum constants string name. 29 // Throws an error if the param is not part of the enum. 30 func CaseOpString(s string) (CaseOp, error) { 31 if val, ok := _CaseOpNameToValueMap[s]; ok { 32 return val, nil 33 } 34 return 0, fmt.Errorf("%s does not belong to CaseOp values", s) 35 } 36 37 // CaseOpValues returns all values of the enum 38 func CaseOpValues() []CaseOp { 39 return _CaseOpValues 40 } 41 42 // IsACaseOp returns "true" if the value is listed in the enum definition. "false" otherwise 43 func (i CaseOp) IsACaseOp() bool { 44 for _, v := range _CaseOpValues { 45 if i == v { 46 return true 47 } 48 } 49 return false 50 }