0
votes

I'm trying to filter out results inside a slick 3.1.1 query in scala using a function like this:

  def filterByName(names: List[String]) = {
    val q = tableGames.filter(c => c.name inSetBind (names))
    println("FILTERBYNAME: " + q.result.statements.head)
    db.run(q.result)
  }

However, the results always end up empty. If I remove the filtering part it correctly returns all elements in the database. I've created a gist that runs an example end to end right here: gist.

Is it a bug or what am I doing wrong?

1

1 Answers

0
votes

try following,

def filterByName(names: List[String]) = {
    val q = for { game <- tableGames if game.name inSetBind (names)} yield game
    println("FILTERBYNAME: " + q.result.statements.head)
    db.run(q.result)
  }