Skip to content

Commit

Permalink
minors
Browse files Browse the repository at this point in the history
  • Loading branch information
salamonpavel committed Jul 11, 2024
1 parent 4f516ab commit d255f6e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ package object implicits {
}
}

// to be used for both json[] and jsonb[] as it handles well both and we want to avoid collision
// when resolving implicits
// to be used for both json[] and jsonb[] as it handles well both
// and we want to avoid collision when resolving implicits
implicit val jsonOrJsonbArrayGet: Get[List[Json]] = {
Get.Advanced
.other[PgArray](
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import org.scalatest.funsuite.AnyFunSuite
import za.co.absa.db.fadb.DBSchema
import za.co.absa.db.fadb.doobie.DoobieFunction.{DoobieMultipleResultFunction, DoobieSingleResultFunction}
import za.co.absa.db.fadb.testing.classes.DoobieTest
import io.circe.generic.auto._

import za.co.absa.db.fadb.doobie.postgres.circe.implicits.jsonOrJsonbArrayGet

Expand All @@ -36,10 +37,14 @@ class JsonArrayIntegrationTests extends AnyFunSuite with DoobieTest {
val actorsAsJsonList = values.map(_.asJson)
Seq(
{
// has to be imported inside separate scope to avoid conflicts with the import below
// as both implicits are of the same type and this would cause ambiguity
import za.co.absa.db.fadb.doobie.postgres.circe.implicits.jsonArrayPut
fr"$actorsAsJsonList"
},
{
// has to be imported inside separate scope to avoid conflicts with the import above
// as both implicits are of the same type and this would cause ambiguity
import za.co.absa.db.fadb.doobie.postgres.circe.implicits.jsonbArrayPut
fr"$actorsAsJsonList"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,9 @@ import cats.effect.IO
import doobie.util.transactor.Transactor
import doobie.util.transactor.Transactor.Aux
import za.co.absa.db.fadb.DBSchema
import io.circe.{Decoder, Encoder}
import io.circe.generic.semiauto._

trait DoobieTest {
case class Actor(actorId: Int, firstName: String, lastName: String)
object Actor {
implicit val actorEncoder: Encoder[Actor] = deriveEncoder
implicit val actorDecoder: Decoder[Actor] = deriveDecoder
}
case class GetActorsQueryParameters(firstName: Option[String], lastName: Option[String])
case class GetActorsByLastnameQueryParameters(lastName: String, firstName: Option[String] = None)
case class CreateActorRequestBody(firstName: String, lastName: String)
Expand Down
3 changes: 2 additions & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ object Dependencies {
"org.tpolecat" %% "doobie-core" % "1.0.0-RC2",
"org.tpolecat" %% "doobie-hikari" % "1.0.0-RC2",
"org.tpolecat" %% "doobie-postgres" % "1.0.0-RC2",
"org.tpolecat" %% "doobie-postgres-circe" % "1.0.0-RC2"
"org.tpolecat" %% "doobie-postgres-circe" % "1.0.0-RC2",
"io.circe" %% "circe-generic" % "0.14.9" % Test
)
}

Expand Down

0 comments on commit d255f6e

Please sign in to comment.