-
Hi, is it possible to use scala 3's Tuple in doobie? What I want to do is like this def insertStudy(study: Tuple) =
val sql = "INSERT INTO study VALUES (" ++ Range(0, study.size).map(_ => "?").mkString(", ") ++ ")"
HC.prepareStatement(sql)(HPS.set(study)) I've got error message No given instance of type doobie.util.Write[Tuple] was found for parameter A of method set in object preparedstatement. I think Tuple related code is in scala-3/util/WritePlatform.scala but cannot figure out how to use or write Write[Tuple]. |
Beta Was this translation helpful? Give feedback.
Answered by
jatcwang
Jul 25, 2023
Replies: 1 comment 2 replies
-
Maybe this example scala-cli script will help. Note that you need to know the actual Tuple type e.g.
|
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
nineclue
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe this example scala-cli script will help. Note that you need to know the actual Tuple type e.g.
(Int, String)
because we need to know how to set each column at compile time.