Skip to content
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

FR: Proposed changes to .Map #45

Open
hidegh opened this issue Dec 25, 2018 · 1 comment
Open

FR: Proposed changes to .Map #45

hidegh opened this issue Dec 25, 2018 · 1 comment

Comments

@hidegh
Copy link

hidegh commented Dec 25, 2018

Proposed changes to .Map

Although the set-up is a bit different, I think some ideas from AutoMapper could be borrowed...

Currently the .Map function is a bit confusing to use.

First of all it will only be executed for properties where map via annotation failed (somehow feels as if it'd be conflicting with those annotations). And second: the given interface is hard to use (needs a lot of extra code).

Would consider (at least excel to object) following changes:

No1
have a ShouldMap function to replace the current .Map - first callback function (should map column)

  • should provide original excel column
  • should provide mapped destination property (if a match via attributes was found) - along with some match details

should return

  • null (if no mapping should occure)
  • or the destination property with a transformation function (optional)

No2
the Map function should change as follows (to work similarly as in case of AutoMapper):

  • should be aware of the original excel column
  • as of the destination column

...and should allow to do any kind of data manipulation from the excel value, before assigning it to the destination property (even value type changes by parsing and so)

Currently we need to match column names as find property names before we can do any extra changes... This would be maybe the first thing i'd consider to change (to pass the matched propertyname to the call)!

No3
AfterMap / BeforeMap could also help to do extra manipulation

@donnytian donnytian added this to the v4 milestone Jun 29, 2019
@hidegh
Copy link
Author

hidegh commented May 29, 2020

Any update on this? Estimation of V4 release date?

@donnytian donnytian removed this from the v4 milestone Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants