-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
I think sometimes there are cases where you have enum-like fields based on integers:
type Task struct {
// ...
Status MyStatusType
// ...
}
type MyStatusType uint8
const (
StatusTodo MyStatusType = iota
StatusInProgress
StatusDone
)
However, you might want to match these with human-friendly values such as todo
, in progress
, done
, etc.
For such cases, it would be handy to have the possibility to define a custom value matcher. To keep it simple, we can assume that these custom values are stored as strings. In that scenario, we can simply try to call the String()
method on the field (for example, by checking if the value implements fmt.Stringer
) before performing the actual matching. Alternatively, to make it more predictable and handy, we could expect a separate method that performs the same function.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers