Open
Description
How do you feel about adding a new module with Put and Get instances for json and jsonb for tethys similar to doobie-postgres-circe?
smth like that
trait JsonBTethysInstances {
implicit private val showPGobject: Show[PGobject] = Show.show(_.getValue.take(250))
def jsonbPut[T: JsonWriter]: Put[T] =
Put.Advanced.other[PGobject](
NonEmptyList.of("jsonb")
).tcontramap { a =>
val o = new PGobject
o.setType("jsonb")
o.setValue(a.asJson)
o
}
def jsonbGet[T: JsonReader]: Get[T] =
Get.Advanced.other[PGobject](
NonEmptyList.of("jsonb")
).temap(_.getValue.jsonAs[T].leftMap(_.getMessage))
}
and the similar for "json"
Metadata
Metadata
Assignees
Labels
No labels