Open Krever opened 5 years ago
Having similar issue with querySchema
, which breaks batch inserts. Seems pretty major issue, no?
@Krever I have tried removing the type ascription however this means the implicit value isn't even picked up. According to Intellij the implicit isn't even used and also judging by the compile output of the query it isn't even picked up.
Actually ignore my above comment, Intellij was wrong and quill was actually picking it up
Hi, are there any plans on fixing this?
It may be the same issue, I have an error trying to write generic insert code like
def store[A: SchemaMeta : Encoder](datas: List[A]): ZIO[Any, PostgresWriteError, Unit] = ZIO.attempt {
val q = quote {
liftQuery(datas).foreach(d => query[A].insertValue(d))
}
ctx.run(q)
}.mapError(e => PostgresWriteError(e.getMessage)).unit
this example fails with a compile error : Batch actions must be static quotations. Found: 'q'
Adding type annotation in
breaks batch queries but doesnt affect normal ones.
I'm, raising this mostly to help other people google the answer. It would be nice to fix it (either by a better error message, a warning message or changing the behavior) but I expect it's not so easy.
Version: 2.6.0 Module: core? Database: any
Actual behavior
Steps to reproduce the behavior
https://scastie.scala-lang.org/VKzicxs6SKukBdlkXw6ZZg
Workaround
Remove type ascription
@getquill/maintainers