All Questions
Tagged with doobie cats-effect
14
questions
0
votes
1
answer
80
views
how to implement error handling with doobie
override def getUser(uuid: UUID): F[Either[String, User]] = {
val query = sql"""SELECT email, password FROM "user" WHERE "userId" = $uuid """
...
1
vote
0
answers
374
views
Create clickhouse temporary table with doobie
I want to create clickhouse temporary table with doobie, but i don't know how to add session_id parameter in query
I tried
val sql =
sql"CREATE TEMPORARY TABLE " ++ Fragment.const(...
0
votes
1
answer
153
views
For comprehension that has to handle 2 optional values and return a Option[T]
The below code works fine, but as you can see the 2nd clause in the for comprehension has a call that is unsafe.
case class ProductView(product: Product, stores: List[Store], warehosue: Option[...
0
votes
1
answer
444
views
Testing Doobie Interpreter Using Testcontainers
I'm trying to test some SQL statements developed with doobie using Testcontainers libraries. In detail, I'm using the following dependencies:
"org.testcontainers" % "testcontainers"...
0
votes
1
answer
191
views
Parallelizing operations within a ConnectionIO transaction
So I have a program in which I get a list of file paths from a database, delete those files on the filesystem and finally delete the file paths from the database. I put all operations inside a ...
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 ...
1
vote
1
answer
341
views
Scala Doobie not inserting values into database
My code to insert values is:
def insert(link: entity.Link) : IO[Int] = {
logger.info("Inserting link: " + link.toString())
sql"insert into links (title,url,publication_date,...
1
vote
0
answers
154
views
akka message wrtite into a doobie as a sink to postgres
I Have an issue when i try to write into a postgres table from an akka actor when it receives the message data.
I dont't know exactly the real probem i think that is the async context, because when i ...
7
votes
1
answer
3k
views
Is it okay to use "unsafeRunSync()" in Cats-Effects?
I am using Doobie and in the examples that I found, it uses unsafeRunSync, like:
sql"select name from country"
.query[String] // Query0[String]
.to[List] // ConnectionIO[List[...
1
vote
1
answer
843
views
Doobie running multiple effects f1 and f2 in a transaction in the generic context F?
I would like to run two effects f1 and f2 updating two different database tables t1 and t2 while staying in the generic F context.
def update(model:Details): Update0 = sql"""Update details_compta
...
1
vote
1
answer
1k
views
Cannot construct a Read instance for type User. Type misunderstanding with Doobie in Scala
I am trying to return a User record from a database using doobie, http4s, and cats. I have been stymied by the type system, which is providing the following error based on the code below:
router:
...
2
votes
2
answers
2k
views
Save Doobie stream from database to file
Doobie select returns an fs2.Stream(doobie.ConnectionIO, String). If we need to write it to file the obvious option is to call stream.compile.toList.transact(transactor) and then save this list to ...
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: ...
2
votes
1
answer
1k
views
How to write a doobie transaction when there's an IO stuck in the middle
I want to write a basic doobie read/write transaction, however the kicker is that there is an IO returning call in the middle. I want to do something like this:
abstract class MyDAO {
def ...