case class User(name: String, age: Int)
def changeNameQuery(): Query[UserTable, User, Seq] = {
TableQuery[UserTable].map { user =>
(Case If (user.name === "A") Then "B" Else "A",
user.age
)
}
}
i get this error
[error] found : slick.lifted.Query[(slick.lifted.Rep[String], slick.lifted.Rep[Int]),(String, Int),Seq]
[error] required: repositories.postgres.PostgresProfile.api.Query[repositories.postgres.UserTable,model.User,Seq]
Maybe there is some way to get a table object back from a tuple?
At first sight it seems a typing problem. You are saying that you will return a
Query[User Table, User, Seq], which means from the user table you are going to return a list of users. The error says that you are returning a tuple(String,Int)instead ofUser.Instead of doing
You need to return a
Useror change the return type of your method. It depends on what you need