Skip to content

forProduct$arity

Compare
Choose a tag to compare
@thurstonsand thurstonsand released this 28 Feb 06:27
· 25 commits to master since this release

now CCCassFormatEncoder and CCCassFormatDecoder have a forProduct$arity fn. Use like:

case class CustomCC(f1: String, f2: Int)

implicit val encoder: CCCassFormatEncoder[CustomCC] = 
  CCCassFormatEncoder.forProduct2("cassandra_field_1", "cassandra_field_2")(CustomCC.apply)
implicit val decoder: CCCassFormatDecoder[CustomCC] = 
  CCCassFormatDecoder.forProduct2("cassandar_field_1", "cassandra_field_2")(ccc => (ccc.f1, ccc.f2))
  • There is a forProduct$arity for every arity 1-22
  • The first String arguments specify what the names of the columns are in Cassandra
  • The following function provides the encode/decode to the right Scala type for the library