当前位置: 首页>>代码示例>>Scala>>正文


Scala MySQLDriver类代码示例

本文整理汇总了Scala中slick.driver.MySQLDriver的典型用法代码示例。如果您正苦于以下问题:Scala MySQLDriver类的具体用法?Scala MySQLDriver怎么用?Scala MySQLDriver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MySQLDriver类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。

示例1: MySQLService

//设置package包名称以及导入依赖的类
package services

//import slick.driver.{JdbcProfile, PostgresDriver}
//import slick.driver.PostgresDriver.api._

import slick.driver.{JdbcProfile, MySQLDriver}
import slick.driver.MySQLDriver.api._

class MySQLService(jdbcUrl: String, dbUser: String, dbPassword: String) extends DatabaseService {

  // Setup our database driver, Postgres in this case
  //  val driver: JdbcProfile = PostgresDriver
  val driver: JdbcProfile = MySQLDriver

  // Create a database connection
  val db: Database = Database.forURL(jdbcUrl, dbUser, dbPassword)
  db.createSession()
} 
开发者ID:greven77,项目名称:AkkaHTTPBookstore,代码行数:19,代码来源:MySQLService.scala

示例2: JdbcProfileProvider

//设置package包名称以及导入依赖的类
package au.com.agiledigital.dao.slick

import slick.driver.{ DerbyDriver, H2Driver, HsqldbDriver, JdbcProfile, MySQLDriver, PostgresDriver, SQLiteDriver }

trait JdbcProfileProvider {
  type JP <: JdbcProfile
  val driver: JP
}

object JdbcProfileProvider {

  trait H2ProfileProvider extends JdbcProfileProvider {
    type JP = H2Driver
    val driver: H2Driver = H2Driver
  }

  trait PostgresProfileProvider extends JdbcProfileProvider {
    type JP = PostgresDriver
    val driver = PostgresDriver
  }

  trait DerbyProfileProvider extends JdbcProfileProvider {
    type JP = DerbyDriver
    val driver = DerbyDriver
  }

  trait HsqlProfileProvider extends JdbcProfileProvider {
    type JP = HsqldbDriver
    val driver = HsqldbDriver
  }

  trait MySQLProfileProvider extends JdbcProfileProvider {
    type JP = MySQLDriver
    val driver = MySQLDriver
  }

  trait SQLLiteProfileProvider extends JdbcProfileProvider {
    type JP = SQLiteDriver
    val driver = SQLiteDriver
  }

} 
开发者ID:agiledigital,项目名称:slick-dao,代码行数:43,代码来源:JdbcProfileProvider.scala

示例3: Generate

//设置package包名称以及导入依赖的类
package org.example

import scala.reflect.runtime.{ universe => ru }
import slick.driver.MySQLDriver

object Generate {

  def main(args: Array[String]): Unit = {
    val slickDriver = "slick.driver.MySQLDriver"
    val jdbcDriver = "com.mysql.jdbc.Driver"
    val url = "jdbc:mysql://localhost:3306/automutton?characterEncoding=UTF8"
    val outputFolder = "/Users/ishikawayuuki"
    val pkg = "model"
    val user = "root"
    val password = ""

    slick.codegen.SourceCodeGenerator.main(
      Array(slickDriver, jdbcDriver, url, outputFolder, pkg, user, password)
    )
  }

} 
开发者ID:yuukiishikawa,项目名称:sbt-slick-code-generator,代码行数:23,代码来源:Generate.scala


注:本文中的slick.driver.MySQLDriver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。