snake case for column names in phantom-dsl

66 Views Asked by At

Im trying to use this library for an existing application that already have records in cassandra and it table columns are written in snake case. Is there a way to have my phantom model objects in snake case.

2

There are 2 best solutions below

1
flavian On BEST ANSWER

Have a look here, at the official documentation.

import com.outworkers.phantom.NamingStrategy.SnakeCase.caseSensitive
import com.outworkers.phantom.NamingStrategy.SnakeCase.caseInsensitive

There is also a test suite that might be of help, but you need to import this in every file where you define tables. Tests are here.

0
shaloms On

Just override column name:

abstract class User extends Table[...] {

   object lastName extends StringColumn {
       override val name: String = "last_name"
   }

}