frees-io / freestyle-cassandra

Freestyle Cassandra
http://frees.io/
Apache License 2.0
17 stars 4 forks source link

Update FieldLister to use an implicit Printer #104

Closed fedefernandez closed 7 years ago

fedefernandez commented 7 years ago

A Printer is just a trait that transforms a String into a String, as shown here: https://github.com/frees-io/freestyle-cassandra/blob/c4ed44a04eb0f30bf8871a0286fb0faf8626e0c8/core/src/main/scala/query/query.scala#L29-L31

We currently have a FieldLister that provides a way to list the column names for a case class: https://github.com/frees-io/freestyle-cassandra/blob/bd02435fd222e9ac970d40a42690e87d167def89/core/src/main/scala/query/FieldLister.scala#L23-L25

We need to refactor it to make use of an implicit Printer instead of using the actual case class field name here: https://github.com/frees-io/freestyle-cassandra/blob/bd02435fd222e9ac970d40a42690e87d167def89/core/src/main/scala/query/FieldLister.scala#L31

We also need to adapt Unit Tests to this new implementation. The tests are located here: https://github.com/frees-io/freestyle-cassandra/blob/65876ad1db93dd3b814f1bb8015f8b68c5036d2f/core/src/test/scala/query/StatementGeneratorSpec.scala#L31-L80

An example of the behavior we are looking for can be found here: https://github.com/frees-io/freestyle-cassandra/blob/c4ed44a04eb0f30bf8871a0286fb0faf8626e0c8/core/src/main/scala/query/mapper/ByteBufferToField.scala#L38-L54