2025-01-15 10:56:44 +01:00
|
|
|
|
package enum
|
2024-12-12 16:25:47 +01:00
|
|
|
|
|
|
|
|
|
type ScheduledType int
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
DRAFT ScheduledType = iota
|
|
|
|
|
SCHEDULED
|
|
|
|
|
STARTED
|
|
|
|
|
FAILURE
|
|
|
|
|
SUCCESS
|
|
|
|
|
FORGOTTEN
|
|
|
|
|
DELAYED
|
|
|
|
|
CANCELLED
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var str = [...]string{
|
|
|
|
|
"draft",
|
|
|
|
|
"scheduled",
|
|
|
|
|
"started",
|
|
|
|
|
"failure",
|
|
|
|
|
"success",
|
|
|
|
|
"forgotten",
|
|
|
|
|
"delayed",
|
|
|
|
|
"cancelled",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func FromInt(i int) string {
|
|
|
|
|
return str[i]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (d ScheduledType) String() string {
|
|
|
|
|
return str[d]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// EnumIndex - Creating common behavior - give the type a EnumIndex functio
|
|
|
|
|
func (d ScheduledType) EnumIndex() int {
|
|
|
|
|
return int(d)
|
|
|
|
|
}
|
2025-01-15 11:09:33 +01:00
|
|
|
|
|
|
|
|
|
// List
|
|
|
|
|
func ScheduleList() []ScheduledType {
|
|
|
|
|
return []ScheduledType{DRAFT, SCHEDULED, STARTED, FAILURE, SUCCESS, FORGOTTEN, DELAYED, CANCELLED}
|
|
|
|
|
}
|