0
I am getting an error with the code below
val query: Query[(String *: Int), ValueObject] =
sql"""
SELECT field1, field2
FROM sample_table
WHERE field1 = $text
AND field2 = $int4
""".query(ValueObject.decoder)
database.use(s => s.option(query)((param1, param2)))
And the decoder is here:
case class ValueObject(field1: Int, field2: String)
object ValueObject {
val decoder: Decoder[ValueObject] =
(int4 ~ varchar).map { case (f1, f2) => ValueObject(f1, f2) }
}
And the error is:
type mismatch;
found : skunk.Query[String *: Int *: org.typelevel.twiddles.EmptyTuple,br.com.ValueObject]
(which expands to) skunk.Query[String :: Int :: shapeless.HNil,br.com.ValueObject]
required: skunk.Query[String *: Int,br.com.ValueObject]
(which expands to) skunk.Query[String :: Int,br.com.ValueObject]
""".query(ValueObject.decoder)
Where is actually the problem?