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

41 lines
1008 B
Go
Raw Normal View History

package entity
type KindBoxReqStatus uint
const (
KindBoxReqPendingStatus KindBoxReqStatus = iota + 1
KindBoxReqAcceptedStatus
KindBoxReqRejectedStatus
)
2024-01-02 15:35:26 +00:00
var kindBoxReqStatusStrings = map[KindBoxReqStatus]string{
KindBoxReqPendingStatus: "pending",
KindBoxReqAcceptedStatus: "accepted",
KindBoxReqRejectedStatus: "rejected",
}
func (s KindBoxReqStatus) String() string {
2024-01-02 15:35:26 +00:00
return kindBoxReqStatusStrings[s]
}
// AllKindBoxReqStatus returns a slice containing all string values of KindBoxReqStatus.
func AllKindBoxReqStatus() []string {
2024-01-02 15:35:26 +00:00
statusStrings := make([]string, len(kindBoxStatusStrings))
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 {
2024-01-02 15:35:26 +00:00
for status, str := range kindBoxReqStatusStrings {
if str == statusStr {
return status
}
}
return KindBoxReqStatus(0)
}