Slick left/right/outer joins with Option

后端 未结 4 2219
一向
一向 2020-12-25 14:38

In the Slick examples there are a few examples of joining where one of the resulting columns can be nulls, as it can be the case when doing left, right, or outer joins. For

4条回答
  •  半阙折子戏
    2020-12-25 15:29

    In addition to the answer above: In case you have a class which extends Table and your * projection looks something like this:

    def * = (col1, col2, col3)
    

    than your ? function would look like:

    def ? = (col1.?, col2.?, col3.?)
    

    If you have defined such a function you can write:

    for {
        (x,y) <- x leftJoin y on (...)
    } yield (x, y.?)
    

提交回复
热议问题