go-jet / jet

Type safe SQL builder with code generation and automatic query result data mapping
Apache License 2.0
2.23k stars 110 forks source link

Handle plus and minus identifiers better #311

Closed jupp0r closed 4 months ago

jupp0r commented 5 months ago

This change improves handling of db identifiers:

codecov-commenter commented 5 months ago

Codecov Report

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

Comparison is base (e03773a) 90.35% compared to head (5049a50) 90.36%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #311 +/- ## ========================================== + Coverage 90.35% 90.36% +0.01% ========================================== Files 124 124 Lines 7162 7173 +11 ========================================== + Hits 6471 6482 +11 Misses 530 530 Partials 161 161 ```

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

go-jet commented 4 months ago

I've changed my mind on this one. There were couple of bugs opened before for similar invalid character issues. To prevent any additional bugs opened, I've made a change that replaces all invalid ascii characters with they description.
In your case, you would still need to customize generator because minus and hyphen are the same character, and hyphen is first replaced with underscore, and underscores at the end of identifier are removed.