-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
documentation: convert and map option behavior #41
Comments
I may need more information from you to consider this an edge case. Context
Your example includes a single function You have defined a conversion function To reiterate:
SolutionI assume that you would like these two fields to be matched in addition to the If this is the case, you must rewrite your setup file. Example Setup File 1type Copygen interface {
// map Model.SomeString1 Domain.Sub.SomeString1
// map Model.SomeString2 Domain.Sub.SomeInteger2
Mapper(model *Model) *Domain
} Example Setup File 2type Copygen interface {
// automatch .*
// map Model.SomeString1 Domain.Sub.SomeString1
Mapper(model *Model) *Domain
} If either of these configurations do not work, please ask me to re-open this issue with further context. |
Upon further review of the Copygen README, this reopened issue is currently categorized as a user error (due to documentation). IssueThis user error has occurred because the behavior of the conversion option as a modifying option — as opposed to a matching option — is not clear. A matching option (e.g. SolutionThis issue is fixed once a clarifying statement is added for matching vs. modifier option behavior (including the |
Ohhh. This feels like double work in many cases though. I had to go ahead with goverter as it was saner in this as well as it raised an error in case any field was not matched. I'd recommend adding a flag for error as well just in case. |
I am able to use
map
for mapping a field within model to struct inside domain directly but doing the same via aconvert
does not work.I also tried using a pointer to the field (as argument to the convert function) but it is still of no use.
On a side note, I am using this as an alternative to mapstruct in Java (https://mapstruct.org/)
Domains&Models
YML
Setup Go
Output
Generation
Environment
Operating System: MacOS
Copygen Version: v0.4.0
The text was updated successfully, but these errors were encountered: