A generic Product class shape that can be used to lift a class of
plain Scala types to a class of lifted types. This allows the type
to be used as a record type (like tuples and HLists) in the Lifted
Embedding.
This can help with mapping tables >22 columns to classes, especially
when using code generation. This can be used for Scala 2.11 case classes >22 fields.
Example:
def columnShape[T](implicit s: Shape[FlatShapeLevel, Column[T], T, Column[T]]) = s
class C(val a: Int, val b: Option[String]) extends Product{
def canEqual(that: Any): Boolean = that.isInstanceOf[C]
def productArity: Int = 2
def productElement(n: Int): Any = Seq(a, b)(n)
}
class LiftedC(val a: Column[Int], val b: Column[Option[String]]) extends Product{
def canEqual(that: Any): Boolean = that.isInstanceOf[LiftedC]
def productArity: Int = 2
def productElement(n: Int): Any = Seq(a, b)(n)
}
implicit object cShape extends ProductClassShape(
Seq(columnShape[Int], columnShape[Option[String]]),
seq => new LiftedC(seq(0).asInstanceOf[Column[Int]], seq(1).asInstanceOf[Column[Option[String]]]),
seq => new C(seq(0).asInstanceOf[Int], seq(1).asInstanceOf[Option[String]])
)
Build a packed representation containing QueryParameters that can extract
data from the unpacked representation later.
This method is not available for shapes where Mixed and Unpacked are
different types.
Build a packed representation containing QueryParameters that can extract
data from the unpacked representation later.
This method is not available for shapes where Mixed and Unpacked are
different types.