All Downloads are FREE. Search and download functionalities are using the official Maven repository.

storage.hikari.scala Maven / Gradle / Ivy

The newest version!
package nelson
package storage

import doobie.contrib.hikari.hikaritransactor._
import scalaz.concurrent.Task

object Hikari {

  def build(db: DatabaseConfig): HikariTransactor[Task] = {
    val trans = for {
      xa <- HikariTransactor[Task](db.driver, db.connection, db.username.getOrElse(""), db.password.getOrElse(""))
       _ <- xa.configure(hx => Task.delay(db.maxConnections.foreach(max => hx.setMaximumPoolSize(max))))
    } yield xa

    trans.run
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy