Support for timestamp_ms and date avro types bases on java.time.LocalDateTime and java.time.LocalDate
@julianpeeters Let me know if this goes in the right direction and I would add the sbt-avrohugger tests for serialization once we are happy with the approach.
something like this idl (avpr and avs also supported)
@namespace("example.idl")
protocol LogicalIDL {
record LogicalIdl {
decimal(9, 2) dec = 8888.88;
union {decimal(9, 2), null} maybeDec = 9999.99;
timestamp_ms ts = 1526573732000; //ms from the unix epoch
date dt = 600; //days from the unix epock, no time precission
}
}
Generates:
/** MACHINE-GENERATED FROM AVRO SCHEMA. DO NOT EDIT DIRECTLY */
package example.idl
case class LogicalIdl(dec: BigDecimal = scala.math.BigDecimal("8888.88"), maybeDec: Option[BigDecimal] = Some(scala.math.BigDecimal("9999.99")), ts: java.time.LocalDateTime = java.time.LocalDateTime.ofInstant(java.time.Instant.ofEpochMilli(1526573732000L), java.util.TimeZone.getDefault().toZoneId()), dt: java.time.LocalDate = java.time.LocalDate.ofEpochDay(600L))
Support for
timestamp_ms
anddate
avro types bases onjava.time.LocalDateTime
andjava.time.LocalDate
@julianpeeters Let me know if this goes in the right direction and I would add the
sbt-avrohugger
tests for serialization once we are happy with the approach.something like this idl (avpr and avs also supported)
Generates: