It would be nice for mog to support conversions to/from types using generic struct fields, such as the following example.
type Gateway struct {
Status Status[GatewayConditionType]
}
type Route struct {
Status Status[RouteConditionType]
}
type Status[T ConditionType] struct {
Type T
}
type ConditionType interface {
GatewayConditionType | RouteConditionType
}
type GatewayConditionType string
const {
GatewayConditionAccepted GatewayConditionType = "Accepted"
GatewayConditionInSync GatewayConditionType = "InSync"
}
type RouteConditionType string
const {
RouteConditionAccepted RouteConditionType = "Accepted"
RouteConditionResolvedRefs RouteConditionType = "ResolvedRefs"
}
https://github.com/golang/exp/tree/master/typeparams/example and https://pkg.go.dev/go/types should provide some guidance for how to approach adding this functionality.
It would be nice for mog to support conversions to/from types using generic struct fields, such as the following example.
https://github.com/golang/exp/tree/master/typeparams/example and https://pkg.go.dev/go/types should provide some guidance for how to approach adding this functionality.