Refined type support.
syodage opened this issue · 0 comments
syodage commented
Bring refined type support for Typeclasses. Especially for Avro
and BigQuery
i.e avro
example.
import eu.timepit.refined.api._
import eu.timepit.refined.numeric._
type PosInt = Int Refined Positive
case class Person(name: String, age: PosInt)
val avroPerson = AvroType[Person]
val schema = avroPerson.schema) // schema will have valid avro types for based refine types
val bPersonGen = new GenericRecordBuilder(avroPerson.schema)
.set("name", "Martin")
.set("age", -10) // wrong value, should be positive int
.build()
avroPerson.from(bPersonGen) // this will throw an error