Closed williamhaw closed 11 months ago
Thanks William, IIRC the postgres JDBC driver doesn't have a JsonB type, so you'll have to use String and decode separately.
If you find it's a common pattern in your code, one option would be to
For example:
opaque type Json = Any
// in a different file
case class Friend(id: Int, name: String) derives MyJsonCodec
case class User(id: Int, friends: Seq[Friend] & Json) derives DbCodec
given JsonBCodec[A](using jsonCodec: MyJsonCodec[A]): DbCodec[A & Json] = ???
Thanks!
My pleasure. Feel free to re-open or file another issue if anything comes up.
hi @AugustNagro, thanks for this amazing library!
Is it possible to decode JSONB columns from Postgres directly? Or should I query it as string and then decode it separately?