0
我正在嘗試使用scalikejdbc(試圖從Slick中移出),並且我堅持從實體創建我的模式(讀取:case類)。從案例類中提取DDL
// example Slick equivalent
case class X(id: Int, ...)
class XTable(tag: Tag) extends Table[X] (tag, "x") {
def id = column[Int]("id")
... //more columns
def * = (id, ...) <> (X.tupled, X.unapply)
}
val xTable = TableQuery[XTable]
db.run(xtable.schema.create) //creates in the DB a table named "x", with "id" and all other columns
這似乎是使用SQLSyntaxSupport可能是在正確的方向邁出的一步,具有類似
// scalikejdbc
case class X (id: Int, ...)
object X extends SQLSyntaxSupport[X] {
def apply (x: ResultName[X])(rs: WrappedResultSet): X = new X(id = rs.get(x.id, ...))
}
X.table.??? // what to do now?
但無法弄清楚下一步。
我正在尋找的是[逆向工程]中所描述的工具的反面:http://scalikejdbc.org/documentation/reverse-engineering.html
任何幫助/想法,在特定方向的文檔的相關部分,可以理解