typelevel / typelevel/doobie

Add doobie-postgres-tethys integration

Open
#2,247 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
2.2k
Forks
379
Avg merge
14m
Merged PRs (30d)
8

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"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining the existing doobie-postgres-circe module and the Tethys JsonWriter and JsonReader APIs. Add the proposed doobie-postgres-tethys module with Put and Get instances for both json and jsonb, then verify that the integration handles PostgreSQL values as shown in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgres, scala
Domain
databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.