具体的
http://slick.typesafe.com/doc/3.0.3/code-generation.html
object TableGe extends App{
slick.codegen.SourceCodeGenerator.main(
Array("slick.driver.MySQLDriver", "com.mysql.jdbc.Driver", "jdbc:mysql://localhost/test", "table2", "table2", "root", "111111")
)
}
生成的代码比较规范,值得学习
package table2
// AUTO-GENERATED Slick data model
/** Stand-alone Slick data model for immediate use */
object Tables extends {
val profile = slick.driver.MySQLDriver
} with Tables
/** Slick data model trait for extension, choice of backend or usage in the cake pattern. (Make sure to initialize this late.) */
trait Tables {
val profile: slick.driver.JdbcProfile
import profile.api._
import slick.model.ForeignKeyAction
// NOTE: GetResult mappers for plain SQL are only generated for tables where Slick knows how to map the types of all columns.
import slick.jdbc.{GetResult => GR}
/** DDL for all tables. Call .create to execute. */
lazy val schema = Coffees.schema ++ Suppliers.schema
@deprecated("Use .schema instead of .ddl", "3.0")
def ddl = schema
/** Entity class storing rows of table Coffees
* @param name Database column name SqlType(VARCHAR), Length(