jmattheis / goverter

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

feat: `useUnderlyingTypeMethods` #95

Closed jmattheis closed 9 months ago

jmattheis commented 9 months ago

For each type conversion, goverter will check if there is an existing method that can be used. For named types only the type itself will be checked and not the underlying type. For this type:

type InputID  int

InputID would be the named type and int the underlying type.

With useUnderlyingTypeMethods, goverter will check all named/underlying combinations.

Fixes #78

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (cb44e9a) 97.41% compared to head (ba19d0b) 97.47%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #95 +/- ## ========================================== + Coverage 97.41% 97.47% +0.06% ========================================== Files 37 38 +1 Lines 1623 1663 +40 ========================================== + Hits 1581 1621 +40 Misses 29 29 Partials 13 13 ``` | [Files](https://app.codecov.io/gh/jmattheis/goverter/pull/95?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jannis+Mattheis) | Coverage Δ | | |---|---|---| | [builder/builder.go](https://app.codecov.io/gh/jmattheis/goverter/pull/95?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jannis+Mattheis#diff-YnVpbGRlci9idWlsZGVyLmdv) | `100.00% <ø> (ø)` | | | [builder/underlying.go](https://app.codecov.io/gh/jmattheis/goverter/pull/95?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jannis+Mattheis#diff-YnVpbGRlci91bmRlcmx5aW5nLmdv) | `100.00% <100.00%> (ø)` | | | [config/common.go](https://app.codecov.io/gh/jmattheis/goverter/pull/95?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jannis+Mattheis#diff-Y29uZmlnL2NvbW1vbi5nbw==) | `100.00% <100.00%> (ø)` | | | [generator/generate.go](https://app.codecov.io/gh/jmattheis/goverter/pull/95?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jannis+Mattheis#diff-Z2VuZXJhdG9yL2dlbmVyYXRlLmdv) | `100.00% <ø> (ø)` | | | [generator/generator.go](https://app.codecov.io/gh/jmattheis/goverter/pull/95?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jannis+Mattheis#diff-Z2VuZXJhdG9yL2dlbmVyYXRvci5nbw==) | `96.62% <100.00%> (+0.07%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.