Slick 1.0 Raised - Projection Objects

I am trying to implement securesocial (authentication plugin for Play2) using slick.

The problem I am facing is that I want to store everything in one table, but there are several entities that are classes of classes that should be subordinate entities of the user. See Problem: https://github.com/leon/securesocial/blob/slick-demo/samples/scala/slick/app/models/User.scala#L63-L96

My question is, how do I map columns so that they are correctly converted to their respective case classes, where case classes are nested in another case class?

The same problem occurs when converting a single column to the case class https://github.com/leon/securesocial/blob/slick-demo/samples/scala/slick/app/models/User.scala#L61

Where I worked with MappedTypeMapper.base , but I'm not sure if this is the right way. https://github.com/leon/securesocial/blob/slick-demo/samples/scala/slick/app/models/User.scala#L61

Any suggestions would be appreciated!

+4
source share

Source: https://habr.com/ru/post/1468916/


All Articles