forked from ebhomengo/niki
42 lines
970 B
Go
42 lines
970 B
Go
package entity
|
|
|
|
type KindBoxReqStatus uint
|
|
|
|
const (
|
|
KindBoxReqPendingStatus KindBoxReqStatus = iota + 1
|
|
KindBoxReqAcceptedStatus
|
|
KindBoxReqRejectedStatus
|
|
)
|
|
|
|
const (
|
|
kindBoxReqPendingStatusStr = "pending"
|
|
kindBoxReqAcceptedStatusStr = "accepted"
|
|
kindBoxReqRejectedStatusStr = "rejected"
|
|
)
|
|
|
|
|
|
func (s KindBoxReqStatus) String() string {
|
|
return KindBoxReqStatusStrings[s]
|
|
}
|
|
|
|
// AllKindBoxReqStatus returns a slice containing all string values of KindBoxReqStatus.
|
|
func AllKindBoxReqStatus() []string {
|
|
statusStrings := make([]string, len(KindBoxReqStatusStrings))
|
|
for status, str := range KindBoxReqStatusStrings {
|
|
statusStrings[int(status)-1] = str
|
|
}
|
|
|
|
return statusStrings
|
|
}
|
|
|
|
// MapToKindBoxReqStatus converts a string to the corresponding KindBoxReqStatus value.
|
|
func MapToKindBoxReqStatus(statusStr string) KindBoxReqStatus {
|
|
for status, str := range KindBoxReqStatusStrings {
|
|
if str == statusStr {
|
|
return status
|
|
}
|
|
}
|
|
|
|
return KindBoxReqStatus(0)
|
|
}
|