jmattheis / goverter

Generate type-safe Go converters by simply defining an interface
https://goverter.jmattheis.de/
MIT License
487 stars 46 forks source link

how can i convert differently named fields in struct.slices #84

Closed lantegu closed 11 months ago

lantegu commented 12 months ago

Have you read the project readme?

Describe your question A clear and concise description of what the question is. Include errors and go source files. how can i convert Resources to Target, i tryed: // goverter:map Id ID or // goverter: map ResourceItem.Id TargetItem.ID but all of them are failed。 `type Resource struct { Items []*pkg1.ResourceItem }

type Target struct { Items []*pkg2.ResourceItem }

package pkg1 type ResourceItem struct { Id string } package pkg2 type TargetItem struct { ID string } `

jmattheis commented 12 months ago

Post your goverter:converter interface declaration and the errors you're receiving.