mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-22 16:34:32 +01:00
78 lines
1.8 KiB
Go
78 lines
1.8 KiB
Go
|
// Code generated by "enumer -type=StepStatus -trimprefix=Step"; DO NOT EDIT.
|
||
|
|
||
|
//
|
||
|
package hooks
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
_StepStatusName_0 = "PendingExec"
|
||
|
_StepStatusName_1 = "Ok"
|
||
|
_StepStatusName_2 = "Err"
|
||
|
_StepStatusName_3 = "SkippedDueToFatalErr"
|
||
|
_StepStatusName_4 = "SkippedDueToPreErr"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
_StepStatusIndex_0 = [...]uint8{0, 7, 11}
|
||
|
_StepStatusIndex_1 = [...]uint8{0, 2}
|
||
|
_StepStatusIndex_2 = [...]uint8{0, 3}
|
||
|
_StepStatusIndex_3 = [...]uint8{0, 20}
|
||
|
_StepStatusIndex_4 = [...]uint8{0, 18}
|
||
|
)
|
||
|
|
||
|
func (i StepStatus) String() string {
|
||
|
switch {
|
||
|
case 1 <= i && i <= 2:
|
||
|
i -= 1
|
||
|
return _StepStatusName_0[_StepStatusIndex_0[i]:_StepStatusIndex_0[i+1]]
|
||
|
case i == 4:
|
||
|
return _StepStatusName_1
|
||
|
case i == 8:
|
||
|
return _StepStatusName_2
|
||
|
case i == 16:
|
||
|
return _StepStatusName_3
|
||
|
case i == 32:
|
||
|
return _StepStatusName_4
|
||
|
default:
|
||
|
return fmt.Sprintf("StepStatus(%d)", i)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var _StepStatusValues = []StepStatus{1, 2, 4, 8, 16, 32}
|
||
|
|
||
|
var _StepStatusNameToValueMap = map[string]StepStatus{
|
||
|
_StepStatusName_0[0:7]: 1,
|
||
|
_StepStatusName_0[7:11]: 2,
|
||
|
_StepStatusName_1[0:2]: 4,
|
||
|
_StepStatusName_2[0:3]: 8,
|
||
|
_StepStatusName_3[0:20]: 16,
|
||
|
_StepStatusName_4[0:18]: 32,
|
||
|
}
|
||
|
|
||
|
// StepStatusString retrieves an enum value from the enum constants string name.
|
||
|
// Throws an error if the param is not part of the enum.
|
||
|
func StepStatusString(s string) (StepStatus, error) {
|
||
|
if val, ok := _StepStatusNameToValueMap[s]; ok {
|
||
|
return val, nil
|
||
|
}
|
||
|
return 0, fmt.Errorf("%s does not belong to StepStatus values", s)
|
||
|
}
|
||
|
|
||
|
// StepStatusValues returns all values of the enum
|
||
|
func StepStatusValues() []StepStatus {
|
||
|
return _StepStatusValues
|
||
|
}
|
||
|
|
||
|
// IsAStepStatus returns "true" if the value is listed in the enum definition. "false" otherwise
|
||
|
func (i StepStatus) IsAStepStatus() bool {
|
||
|
for _, v := range _StepStatusValues {
|
||
|
if i == v {
|
||
|
return true
|
||
|
}
|
||
|
}
|
||
|
return false
|
||
|
}
|