Filtering query via foreign key

13 views
Skip to first unread message

Luis Solano

unread,
Apr 17, 2017, 10:44:03 AM4/17/17
to Slick / ScalaQuery
Hi,

I'm wondering if something like this is possible:

coffees.where(_.supplier.state === "CA"). 

This would return all the coffees with suppliers in California. It would be an implicit join (coffee <-> suppliers via FK). 

I understand this notation (a chain of dots) may not be possible, but maybe a flatMap?. 

What I'd expect tho is to be able to navigate an arbitrary number of FKs.

The goal is to leave the joins implicit and same goes for remapping (.map(_._2) if I did an explicit join)

Any takes?

Thank you!
- Luis
Reply all
Reply to author
Forward
0 new messages