How about this?
case class Container(name: String, width: Float, height: Float, isApproved: Boolean)
val c: Container = ...
val approvedContainer = c.copy(isApproved=true)
And in Slick
...
def * = (name, width, height, false) <> (Container.tupled, Container.unapply)
...
I haven't tried it and there is a chance you run into insertion problems with the above, which you may be able to work around or not.
Another way to do it:
case class Container(name: String, width: Float, height: Float)(val isApproved: Boolean)
object Container{
def applyFunction = (Container.apply _).tupled
def approve(c: Container) = applyFunction(Container.unapply(c).get)(true)
def createNonApproved = (t: (String, Float, Float)) => applyFunction(t)(false)
}
And in Slick
...
def * = (name, width, height, false) <> (Container.createNonApproved, Container.unapply)
...
Be aware that equality of case classes only compares the first argument list.
scala> Container("foo",1,2)()
res2: Container = Container(foo,1.0,2.0)
scala> Container.approve(res2)
res3: Container = Container(foo,1.0,2.0)
scala> res2 == res3
res4: Boolean = true
scala> res2.isApproved
res5: Boolean = false
scala> res3.isApproved
res6: Boolean = true
Be aware of https://issues.scala-lang.org/browse/SI-3664