forked from ebhomengo/niki
1
0
Fork 0
niki/entity/kind_box_req_status.go

42 lines
970 B
Go
Raw Normal View History

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)
}