2
votes

I am trying to update line by custom field or insert new line if line does not exists into table. Can I do it by one query with slick 3.0 ?

Done it by 2 queries like this.

 Await.result(db.run(myQ.filter(_.firstUserId === my.firstUserId).result), Duration.Inf).headOption match {
      case Some(l) => update(myQ.update(l.updateStatus(my.status)))
      case None => Await.result(db.run(myQ += my), Duration.Inf)
    }

BR!

1

1 Answers