Reputation: 331
Given the following using Slick 3.2:
val contacts = TableQuery[ContactTable]
val phones = TableQuery[PhoneTable]
val query = contacts.joinLeft(phones).on(_.contact_id === _.id)
query.filter{ case (contact, maybePhone) => ... }
maybePhone is a Rep[Option[PhoneTable]]. How can I filter on its properties? (Something like maybePhone.contains(_.areaCode === "212").)
Upvotes: 2
Views: 853
Reputation: 51658
Try mapping:
query.filter{ case (contact, maybePhone) => maybePhone.map(_.areaCode === "212") }
Upvotes: 2