light modification
This commit is contained in:
38
models/common/enum/schedule.go
Normal file
38
models/common/enum/schedule.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package enum
|
||||
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user