Goverter could use the addition of generic type aliases (go1.24), to declare arguments as context or update argument. E.g. the following converter
// goverter:converter
type Converter interface {
// goverter:update target
ConvertUpdate(source Input, target *Output) error
// goverter:context dateFormat
ConvertContext(source map[string]Input, dateFormat string) map[string]Output
}
could be written as
import "github.com/goverter/arg"
// goverter:converter
type Converter interface {
ConvertUpdate(source Input, target arg.Target[*Output]) error
ConvertContext(source map[string]Input, dateFormat arg.Context[string]) map[string]Output
}
where github.com/goverter/arg would contain something like:
type Context[T any] = T
type Target[T any] = T
Please 👍 this issue if you like this functionality. If you have a specific use-case in mind, feel free to comment it.
Goverter could use the addition of generic type aliases (go1.24), to declare arguments as context or update argument. E.g. the following converter
could be written as
where
github.com/goverter/argwould contain something like:Please 👍 this issue if you like this functionality. If you have a specific use-case in mind, feel free to comment it.