It would be cool if goverter could strictly convert named types / enums.
// goverter:converter
type Converter interface {
Convert(InputColor) OutputColor
}
type InputColor int
const (
InputGreen InputColor = iota
InputBlue
InputRed
)
type OutputColor string
const (
OutputGreen OutputColor = "green"
OutputBlue OutputColor = "blue"
OutputRed OutputColor = "red"
)
Goverter should fail if the target enum is missing options from the source type.
Currently, goverter just converts the underlying value for named types. So a named string type will be converted to another named string type, without checking if the value is valid.
It would be cool if goverter could strictly convert named types / enums.
Goverter should fail if the target enum is missing options from the source type.
Currently, goverter just converts the underlying value for named types. So a named string type will be converted to another named string type, without checking if the value is valid.
Unknowns:
goverter:map
to map between enum keys that are differently named. See https://mapstruct.org/documentation/stable/reference/html/#_mapping_enum_to_enum_typesMappingConstants.ANY_REMAINING
like it's done in mapstruct?Please :+1: this issue if you like this functionality