Closed Primetalk closed 2 months ago
Version: master as well as v4.8.3 Module: quill-sql Database: MirrorContext
master
v4.8.3
quill-sql
MirrorContext
Tuple.swap should work at runtime:
Tuple.swap
type MyRow1 = (Int, String) inline def myRow1Query = quote { querySchema[MyRow1]("my_table", t => t._1 -> "int_field", t => t._2 -> "string_field") } inline def g = quote { myRow1Query.map { case (i, s) => (s, i) // return another tuple with parts swapped } } val result = ctx.run(g) require(result.extractor(Row(123, "St"), MirrorSession.default) == ("St", 123))
It fails with
java.lang.RuntimeException: Invalid column type. Expected 'class java.lang.String', but got '123'
The issue can be reproduced using a mirror context:
https://scastie.scala-lang.org/53ULgsWkS3CgKlVwJ0TbxQ
@getquill/maintainers
Looks like I misinterpreted .extractor function. It only works as an extractor from query results, not as a full fledged query interpreter..
.extractor
Version:
master
as well asv4.8.3
Module:quill-sql
Database:MirrorContext
Expected behavior
Tuple.swap
should work at runtime:Actual behavior
It fails with
Steps to reproduce the behavior
The issue can be reproduced using a mirror context:
https://scastie.scala-lang.org/53ULgsWkS3CgKlVwJ0TbxQ
@getquill/maintainers