slick-pg
slick-pg copied to clipboard
slick.jdbc.PostgresProfile.api._ will be conflict with slickpg.ExPostgresProfile.api._
if you import com.github.tminglei.slickpg.ExPostgresProfile.api._
,
and import slick.jdbc.PostgresProfile.api._
meanwhile,you will compile error.
if you import com.github.tminglei.slickpg.ExPostgresProfile.api.Over
,
and import slick.jdbc.PostgresProfile.api._
meanwhile , you will get exception slick.SlickException: Unexpected node WindowFuncExpr
.
So, you should import com.github.tminglei.slickpg.ExPostgresProfile.api._
instead of slick.jdbc.PostgresProfile.api._
if you want to use slick-pg
Yes, ExPostgresProfile
extended PostgresProfile
, and PostgresProfile
didn't know com.github.tminglei.slickpg.ExPostgresProfile.api.Over
.
I think this might be related, but I ran into issues with ExPostgresProfile
and slick.jdbc.JdbcProfile
in slick codegen. The implicits were not being used by the generated code with the default generated :
object MyTable extends {
val profile = MySlickPgPostgresProfile
} with MyTable
trait MyTable {
val profile: slick.jdbc.JdbcProfile
import profile.api._
...
}
wasn't working as expected, but replacing slick.jdbc.JdbcProfile
with my custom profile resolved the problem.
This can be added to a custom code generator using, e.g.:
override def packageCode(profile: String, pkg: String, container: String, parentType: Option[String]): String = {
val defaultProfileClassName = "slick.jdbc.JdbcProfile"
super
.packageCode(profile, pkg, container, parentType)
.replace(
defaultProfileClassName,
jdbcProfile match {
case _: ExPostgresProfile => jdbcProfile.getClass.getCanonicalName.replaceAll("\\$", "")
case _ => defaultProfileClassName
}
)
}
where jdbcProfile
is the custom profile