Closed shuqingzai closed 1 year ago
ignoreMissTarget is currently the default, goverter doesn't error when the target struct misses fields that are present on the source struct. ignoreMissSource seems like a duplicate of https://github.com/jmattheis/goverter/issues/23
Could you give a real use-case for goverter:only
?
ignoreMissTarget is currently the default, goverter doesn't error when the target struct misses fields that are present on the source struct. ignoreMissSource seems like a duplicate of #23
Could you give a real use-case for
goverter:only
?
goverter:only
doesn't seem to be necessary
But their functions are similar
ignoreMissAll
is a long awaited feature
I've added a comment to https://github.com/jmattheis/goverter/issues/23#issuecomment-1441902003, for your feature request. I'll close this one as duplicate.
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.
In the above conversion, I only want to convert
Age
Name
It is recommended to add 4 annotations
ignoreMissSource
Indicates ignoring fields missing from the source relative to the target, including:Out.Id
Out.Password
SoInToOut()
needs to addgoverter:ignore OtherMiss
ignoreMissTarget
Indicates to ignore fields missing from the target relative to the source, including:In.OtherMiss
SoInToOut2()
needs to addgoverter:ignore Id
goverter:ignore Password
ignoreMissAll
Indicates ignoring fields that do not match on both sides, including:In.OtherMiss
Out.Id
Out.Password
SoInToOut3()
does not need to add thegoverter:ignore
annotationgoverter:only
Indicates that only the selected fields will be converted, other fields will be ignored SoInToOut4
only:Name
will be converted, other fields will be ignoredThis will greatly reduce the workload of writing
goverter:ignore
annotations, which is very helpful to improve efficiency