多数の小さな列と大きな (たとえば BLOB) 列を含むテーブルがあるとします。
case class Thing(id: Int, small1: String, small2: String, small3: String, large: String)
class ThingMapping(tag: Tag) extends Table[Thing](tag, "things") {
def id = column[Int]("id", O.PrimaryKey, O.NotNull, O.AutoInc)
def small1 = column[String]("small1")
def small2 = column[String]("small2")
def small3 = column[String]("small3")
def large = column[String]("large")
def * = (id, small1, small2, small3, large) <> (Thing.tupled, Thing.unapply)
}
状況によっては、列を除くすべての列についてテーブルをクエリしたいと思いlarge
ます。他にも、入れたいと思います。タプルよりもケースクラスを使用することを好みます。
これを行うためのSlickに良いパターンはありますか?
私が検討したオプション:
- 「スキニー」マッピングと「ファット」マッピングの 2 つのマッピングがあります。
- 大きな列を別のテーブルに分割し、必要に応じて結合します。