Questions tagged [doobie]

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

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

It is not an ORM, nor is it a relational algebra; it simply provides a principled way to construct programs (and higher-level libraries) that use JDBC.

http://tpolecat.github.io/doobie/

99 questions
0
votes
1 answer

Scala doobie syntax error at or near "$1" when pass dynamical vars into INSERT INTO query

I am following official tutorial of doobie. Here is my code: import doobie._ import doobie.implicits._ import doobie.util.ExecutionContexts import cats._ import cats.data._ import cats.effect.IO import cats.implicits._ // We need a ContextShift[IO]…
techkuz
  • 3,608
  • 5
  • 34
  • 62
0
votes
0 answers

Retrying Monix Task - why Task.defer is required here?

I recently spotted a case I can't fully understand while working with Monix Task: There are two functions (in queue msg handler): def handle(msg: RollbackMsg): Task[Unit] = { logger.info(s"Attempting to rollback transaction ${msg.lockId}") …
Michal Ostruszka
  • 2,089
  • 2
  • 20
  • 23
0
votes
1 answer

How do I create a Doobie Meta instance for MySQL using Play JSON?

How do I implement basic serialization/deserialization at the query level using Doobie, MySQL, and Play JSON?
JPotts
  • 302
  • 1
  • 5
0
votes
2 answers

List to multiple anonymous/underscore parameters in for-comprehension

I'm kind of new to Scala/functional so I'm not yet able to use technical language. I'm experiencing problems with a for-comprehension val queries = for { _ <- createBanco _ <- createBancoMedio bankInsertions <-…
0
votes
1 answer

Scala Doobie query hardcoded values

When writing the following query in Doobie : (SELECT id FROM (VALUES(?),(?),(?)) table(id)) UNION SELECT id FROM table I have list of data , e.g. List(1,2,3,4) that is varied-size. How could I interpolate the list of values into SQL VALUES CLAUSE…
WeiChing 林煒清
  • 4,452
  • 3
  • 30
  • 65
0
votes
2 answers

Create list of case class instances

I have 3 vals, each of type Array[String] they are all equal in length val1.length == val2.length // true Next, I created a case class as following: case class resource(name: String, count: Int, location: String) I want to create a list, a…
rangeelo
  • 118
  • 12
0
votes
1 answer

Transforming Doobie ConnectionIO[Option[Int]] without explicit match

I have a ConnectionIO[Option[Int]] and map over the Option to produce a ConnectionIO[Option[String]] with a query the Some[Int] otherwise keep the Nones. I was able to do this with aforcomprehension and amatch`: def findWidgetByOwner(name: String):…
Arne Claassen
  • 14,088
  • 5
  • 67
  • 106
0
votes
1 answer

Scala (doobie): Type is invariant

I'm working on a project with Scala and doobie. I'm trying to implement a transactor trait that may be injected by MacWire and used with different Task/Future monads (e.g. for tests). import doobie.imports import doobie.imports._ import…
Raphael Mäder
  • 776
  • 5
  • 16
-1
votes
1 answer

How to set port number in doobie database url?

My Postgresql-server is running on port 6000 (not the default port 5432). How can I set put this port number into doobie jdbc url? val xa = Transactor.fromDriverManager[IO]( "org.postgresql.Driver", // driver classname …
PokerFace
  • 811
  • 2
  • 9
  • 15
1 2 3 4 5 6
7