In my Cassandra keyspace i have a main offer table and three more copies of same table, oriented to different query arguments, as follow:
offer (primary key offer_id) (... some attributes)
offer_by_product (primary key product_id, offer_id) (... some attributes)
offer_by_seller (primary key seller_id, offer_id) (... some attributes)
offer_by_sku (primary key sku_id, offer_id) (... some attributes)
All columns are exact the same, changing only the partition key and clustering key, but i need to duplicate a lot of code to implement CRUD operations for all four tables using Scala+Phantom.
There are any way to implement my repository, using Scala+Phantom, without code duplication for CRUD operations or some good pratice with less duplication?