Thanks Stefan, that was much more like it (at least for my question).
In the end ( pardon my scala noob code) I was able to get something like this to work. Given a scala enumeration like:
object EliminationPathway extends Enumeration {
val Cyp3A4 = Value("3A4")
val Cyp2D6 = Value("2D6")
val Cyp2C19 = Value("2C19")
val Cyp2B6 = Value("2B6")
val Cyp2C9 = Value("2C9")
val Cyp1A2 = Value("1A2")
}
I was able to define a mapper to/from this enumeration as follows:
// this maps the EliminationPathway enum to and from the database
implicit val eliminationPathwayTypeMapper = MappedTypeMapper.base[EliminationPathway.Value, Int](
// conversion from EliminationPathway to int
{
cyp => cyp.id
},
// conversion back from int to enum
{
id => EliminationPathway(id)
}
)
then define columns on a table like:
def majorPathway = column[EliminationPathway.Value]("majorpathway")