I can seem to get how I can return a List[User] from a raw sql query.
implicit val getUserResult = GetResult(r => User(r.nextInt, ....))
sql"""
select * from users where id =1
""".as[User]
This seems to compile fine, but if I change this to return a list and not a single result I get an error.
.as[List[User]]
Error:
could not find implicit value for parameter rconv: scala.slick.jdbc.GetResult[List[User]]
How can I change the implicit GetResult to return a list?
Update
So I created the implicit like:
implicit val getUserResult = GetResult( r => User(r.nextInt, ....))
val query: StaticQuery0[User] = sql"....."
query.list()
I can this error:
[PSQLException: Bad value for type int : asdf asdfs]
In psql I can see that I have "asdf asdfs" in some columns, but not INT columns. If things compile I'm not sure why I am getting this error, looks like a bug?
Usersince it looks foridwhich I would assume is unique. You can still return this query.as[User]but appendNillike.as[User] :: Nil. - goral