For example, I have an enum like:
type Status int
const (
Normal Status = itoa
Blocked
)
The type of Status
is known, can I get the "Normal" and "Blocked"
by Status
. If there is one way, I think it will be by reflect
.
I do not want to use mapping to solve it. Because this function is used in a library. it is kind of stateless.
Is there any other ways?
Thanks