-
Notifications
You must be signed in to change notification settings - Fork 24
Add support for mapping mixed types #10
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
Conversation
Current coverage is 97.94% (diff: 86.56%)@@ master #10 diff @@
========================================
Files 2 2
Lines 396 438 +42
Methods 0 0
Messages 0 0
Branches 0 0
========================================
+ Hits 396 429 +33
- Misses 0 4 +4
- Partials 0 5 +5
|
8294a15 to
0f7d612
Compare
|
@jeevatkm is this of interest for you? |
|
I like this idea. I got stuck with my personal priorities right now. Thanks for your patience. I will surely get back to this as soon as possible. Thanks. |
|
@rmohr I have went through your implementation. Nice work 👍 Can you please delete IDE file I'm planning to merge this PR into master and bumping version to |
|
@jeevatkm thx for looking int the PR. I removed the file and pushed two more commits on it. One makes sure that the custom converters work for slices and maps and the third one allows copyVal to propagate errors. I needed the error propagation to collect errors from converter invocations. |
|
@rmohr I'm planning to merge this PR. I would like to confirm, did you get a chance to test it real-time? Also can you please take care of git conflicts and squash all commits into one? |
|
Herer are some references where we use it in kubevirt: Mapping different structs and also UUID to string: Some generic mapping code based on this feature: Will rebase and squash everyting after the comming weekend. |
|
@rmohr Thank you for reference. Can you please take care of If I do it, your commits will go under my user Id, I would like to keep yours. |
By allowing to add converters for specific types, mapping mixed types is possible. AddConversion() allows to register callbacks for the conversion on a very fine grained level.
|
@jeevatkm done |
|
Thank you @rmohr |
Hi,
I wanted to map my uuid.UUID type from a field "UUID" to a string field called "UUID". Since this was not possible I added a feature to add custom converters for specific types.
I also added some unit tests. It seems to work but I want to write a little bit more tests and I have some documentation TODOs. Before I do the polishing I wanted to share it with you, to hear what you think about it.