slick-3.0

Slick 3 reusable generic repository

一曲冷凌霜 提交于 2019-11-28 12:52:31
I am experiencing issues making Slick's TableQuery used in a generic fashion. Observe the regular situation: class AccountRepository { override protected val dbConfig = DatabaseConfigProvider.get[JdbcProfile](Play.current) val accounts = TableQuery[Accounts] def all = db.run(accounts.result) ... The idea would be to extract everything possible into generic trait or abstract class in order to avoid repetition. For the sake of simplicity I included only the problematic code. abstract class GenericRepository[T] extends HasDatabaseConfig[JdbcProfile] { override protected val dbConfig =

Slick 3 reusable generic repository

戏子无情 提交于 2019-11-27 07:21:36
问题 I am experiencing issues making Slick's TableQuery used in a generic fashion. Observe the regular situation: class AccountRepository { override protected val dbConfig = DatabaseConfigProvider.get[JdbcProfile](Play.current) val accounts = TableQuery[Accounts] def all = db.run(accounts.result) ... The idea would be to extract everything possible into generic trait or abstract class in order to avoid repetition. For the sake of simplicity I included only the problematic code. abstract class