When I Combine automap and fieldmap, it doesn't work
// goverter:converter
type Converter interface {
// goverter:map . Address
// goverter:map Street Address.StreetName
Convert(FlatPerson) Person
}
type FlatPerson struct {
Name string
Age int
Street string
ZipCode string
}
type Person struct {
Name string
Age int
Address
}
type Address struct {
StreetName string
ZipCode string
}
the error message was as follows
| github.com/jmattheis/goverter/example/nested.FlatPerson
|
| | goverter:map . Address
| |
| |
| |
source. .???
target.Address.StreetName
| | |
| | | string
| |
| | github.com/jmattheis/goverter/example/nested.Address
|
| github.com/jmattheis/goverter/example/nested.Person
Cannot match the target field with the source entry: "StreetName" does not exist.
The solution might be to add the sub context when createing subMethod
It works fine, too, and even handles nested cases. But I don't know if there are other problems
// goverter:converter
type Converter interface {
// goverter:map . Address
// goverter:map . Address.StreetInfo
// goverter:map Street Address.StreetInfo.Name
Convert(FlatPerson) Person
}
type FlatPerson struct {
Name string
Age int
Street string
ZipCode string
}
type Person struct {
Name string
Age int
Address
}
type Address struct {
StreetInfo
ZipCode string
}
type StreetInfo struct {
Name string
}
When I Combine automap and fieldmap, it doesn't work
the error message was as follows
The solution might be to add the sub context when createing subMethod
It works fine.
It works fine, too, and even handles nested cases. But I don't know if there are other problems
generated