
我试图直接在Build.scala中扩展slick.driver.PostgresDriver:
import slick.driver.PostgresDriverimport com.github.tminglei.slickpg._trait MyPostgresDriver extends PostgresDriver with PgArraySupport with PgDateSupport with PgRangeSupport with PgHStoreSupport with PgPlayJsonSupport with PgSearchSupport with PgPostGISSupport { overrIDe val Implicit = new ImplicitsPlus {} overrIDe val simple = new SimpleQLPlus {} trait ImplicitsPlus extends Implicits with ArrayImplicits with DateTimeImplicits with RangeImplicits with HStoreImplicits with JsonImplicits with SearchImplicits with PostGISImplicits trait SimpleQLPlus extends SimpleQL with ImplicitsPlus with SearchAssistants with PostGISAssistants}object MyPostgresDriver extends MyPostgresDriver 但我不知道如何使用代码生成器例程而不是标准驱动程序:
SourceCodeGenerator.main( Array( "scala.slick.driver.PostgresDriver",//how do I use MyPostgresDriver here? "org.postgresql.Driver","jdbc:postgresql://localhost:5432/db?user=root&password=root","app","db" ))你不能让发电机以这种方式拾取类型.它(或者更确切地说是从数据库模式中反向设计模型的Slick代码)当前只检测到一个充满类型的手,并简单地假定所有其他类型的String.这将在未来得到改善.为了使它对列使用不同的类型,您必须自定义生成器.相应的Slick文档示例实际上显示了如何自定义类型:
http://slick.typesafe.com/doc/2.0.0/code-generation.html#customization
总结以上是内存溢出为你收集整理的使用带有Slick 2代码生成器的PostgreSQL JSON类型全部内容,希望文章能够帮你解决使用带有Slick 2代码生成器的PostgreSQL JSON类型所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)