julianpeeters / avrohugger

Generate Scala case class definitions from Avro schemas
Apache License 2.0
201 stars 120 forks source link

Add support for mapping to the underlying Int or long for date/time related fields, as a custom mapper. #193

Closed wwbakker closed 7 months ago

wwbakker commented 7 months ago

Some background information:

The trigger for me adding this, was that converting to Long was the behavior in version 2.5.2 when generating a field with the logicalType of timestamp-micros Upgrading to the newest version generated a field with the ZonedDateTime type, which was not helpful for me :)

wwbakker commented 7 months ago

Results of + test:

[info] Finished in 967 ms
[info] 18 examples, 0 failure, 0 error
[info] Passed: Total 254, Failed 0, Errors 0, Passed 253, Skipped 1
[success] Total time: 2 s, completed 2 Feb 2024, 18:35:50
wwbakker commented 7 months ago

Results of ^ scripted sbt-avrohugger/* in my locally forked sbt-avrohugger project:

[info] + sbt-avrohugger/standard
[success] Total time: 48 s, completed 2 Feb 2024, 18:51:21
[info] Setting `sbtVersion in pluginCrossBuild` to 1.9.8
[info] set current project to sbt-avrohugger (in build file:/Users/wessel/Repos/3rdparty/sbt-avrohugger/)
julianpeeters commented 7 months ago

Oh dang, sorry to break you. Heroic fix. Thank you for the contribution.

Out now, in avrohugger 2.8.3 and sbt-avrohugger 2.8.3

wwbakker commented 7 months ago

No worries, I appreciate your work. Thanks for the quick response!