package entity type KindBoxReqStatus uint const ( KindBoxReqPendingStatus KindBoxReqStatus = iota + 1 KindBoxReqAcceptedStatus KindBoxReqRejectedStatus ) var kindBoxReqStatusStrings = map[KindBoxReqStatus]string{ KindBoxReqPendingStatus: "pending", KindBoxReqAcceptedStatus: "accepted", KindBoxReqRejectedStatus: "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(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 { for status, str := range kindBoxReqStatusStrings { if str == statusStr { return status } } return KindBoxReqStatus(0) }