I'm trying to implement this: http://reactore.com/repository-patterngeneric-dao-implementation-in-scala-using-slick-3/
The example uses an explicit postgres driver. The application I'm working on uses config-based api generation, meaning that I need
XXXX extends HasDatabaseConfigProvider[JdbcProfile] {
import profile.api._
before I can use a lot of slick functionality, e.g. Table
. This is a problem, because I need to have access to this:
abstract class BaseTable[E: ClassTag](tag: Tag, schemaName: [String], tableName: String)
extends Table[E](tag, schemaName, tableName) {
val classOfEntity = classTag[E].runtimeClass
val id: Rep[Long] = column[Long]("id", O.PrimaryKey, O.AutoInc)
}
but Tag and Table are both part of the config API.
I like this implementation and would like to use something as close to it as possible. I found a similar solution here https://stackoverflow.com/a/39504536/1676006 but it's a little harder to follow and I'm not as huge a fan of the result.
Can I implement the pattern I want, or should I start looking for alternative solutions?