Skip to main content

Questions tagged [doobie]

Doobie is a pure functional JDBC layer for Scala and Cats.

10 votes
2 answers
3k views

Doobie - lifting arbitrary effect into ConnectionIO CE3

I am trying to migrate project from cats-effect 2 to cats-effect 3, i am using doobie for interacting with database. Previously i could lift ConnectionIO to IO as it was described, but with the ...
litus's user avatar
  • 103
17 votes
1 answer
5k views

Doobie and DB access composition within 1 transaction

Doobie book says that it's a good practice to return ConnectionIO from your repository layer. It gives an ability to chain calls and perform them in one transaction. Nice and clear. Now let's ...
Eugene Zhulkov's user avatar
12 votes
1 answer
5k views

Doobie cannot find or construct a Read instance for type T

I'm using doobie to query some data and everything works fine, like this: case class Usuario(var documento: String, var nombre: String, var contrasena: String) def getUsuario(doc: String) = ...
santiromf's user avatar
  • 123
7 votes
2 answers
2k views

How to execute list of string SQL statements against a PostgreSQL db in Scala using doobie?

I am porting the following 10 lines of Python code to Scala: import psycopg2 def execute(user, password, database, host, port, *queries): connection = psycopg2.connect(user=user, password=...
pathikrit's user avatar
  • 33.5k
6 votes
4 answers
4k views

Doobie - lifting arbitrary effect into ConnectionIO

I'm trying to send an email in the same transaction as inserting user into a database with Doobie. I know that I can lift IO into ConnectionIO by using Async[ConnectionIO].liftIO(catsIO) where catsIO: ...
Leonti's user avatar
  • 10.8k
4 votes
1 answer
3k views

How do I convert a java.util.UUID to doobie.syntax.SqlInterpolator.SingleFragment?

I am trying to set up a simple scala app with database using doobie, http4s and circe. How do I convert a java.util.UUID to doobie.syntax.SqlInterpolator.SingleFragment ? final case class User(id: ...
Ry2254's user avatar
  • 991
4 votes
1 answer
819 views

How to get optional result in insert statements with Doobie?

I have an optional insert query: val q = sql"insert into some_table (some_field) select 42 where ...(some condition)" Running this query with: q.update.withUniqueGeneratedKeys[Option[Long]]("id") ...
Oleg's user avatar
  • 941
0 votes
1 answer
1k views

How to read JSON out of Doobie Scala PostgreSQL Database with Circe?

I've tried creating the below implicit so that I can GET/read data from the postgreSQL database. I've tried add in the recommended implicits but they turn grey and seem to be unused. implicit val get: ...
Ry2254's user avatar
  • 991