Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
Bump quill to 3.12.0 (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacke authored Jan 20, 2022
1 parent dc26f1f commit 9bc0cb7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ val root = project
.settings(
name := "doobie-quill",
libraryDependencies ++= Seq(
"io.getquill" %% "quill-jdbc" % "3.11.0",
"io.getquill" %% "quill-jdbc" % "3.12.0",
"org.tpolecat" %% "doobie-core" % "1.0.0-RC1",
"org.tpolecat" %% "doobie-postgres" % "1.0.0-RC1" % Test,
"org.scalameta" %% "munit" % "0.7.29" % Test,
Expand Down
25 changes: 14 additions & 11 deletions src/main/scala/org/polyvariant/doobiequill/DoobieContextBase.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package org.polyvariant.doobiequill

import cats.data.Nested
import cats.syntax.all._
import cats.free.Free
import doobie.free.connection.ConnectionOp
import doobie._
import doobie.implicits._
import doobie.util.query.DefaultChunkSize
Expand Down Expand Up @@ -58,7 +60,7 @@ trait DoobieContextBase[Dialect <: SqlIdiom, Naming <: NamingStrategy]
extractor: Extractor[A] = identityExtractor,
)(
info: ExecutionInfo,
dc: DatasourceContext,
dc: Runner
): ConnectionIO[List[A]] =
HC.prepareStatement(sql) {
useConnection { implicit connection =>
Expand All @@ -75,7 +77,7 @@ trait DoobieContextBase[Dialect <: SqlIdiom, Naming <: NamingStrategy]
extractor: Extractor[A] = identityExtractor,
)(
info: ExecutionInfo,
dc: DatasourceContext,
dc: Runner
): ConnectionIO[A] =
HC.prepareStatement(sql) {
useConnection { implicit connection =>
Expand All @@ -94,7 +96,7 @@ trait DoobieContextBase[Dialect <: SqlIdiom, Naming <: NamingStrategy]
extractor: Extractor[A] = identityExtractor,
)(
info: ExecutionInfo,
dc: DatasourceContext,
dc: Runner
): Stream[ConnectionIO, A] =
for {
connection <- Stream.eval(FC.raw(identity))
Expand All @@ -106,13 +108,10 @@ trait DoobieContextBase[Dialect <: SqlIdiom, Naming <: NamingStrategy]
)(extractorToRead(extractor)(connection))
} yield result

override def executeAction[A](
override def executeAction(
sql: String,
prepare: Prepare = identityPrepare,
)(
info: ExecutionInfo,
dc: DatasourceContext,
): ConnectionIO[Long] =
)(info: ExecutionInfo, dc: Runner): ConnectionIO[Long] =
HC.prepareStatement(sql) {
useConnection { implicit connection =>
prepareAndLog(sql, prepare) *>
Expand All @@ -135,7 +134,7 @@ trait DoobieContextBase[Dialect <: SqlIdiom, Naming <: NamingStrategy]
returningBehavior: ReturnAction,
)(
info: ExecutionInfo,
dc: DatasourceContext,
dc: Runner,
): ConnectionIO[A] =
prepareConnections[A](returningBehavior)(sql) {
useConnection { implicit connection =>
Expand All @@ -159,7 +158,7 @@ trait DoobieContextBase[Dialect <: SqlIdiom, Naming <: NamingStrategy]
groups: List[BatchGroup]
)(
info: ExecutionInfo,
dc: DatasourceContext,
dc: Runner
): ConnectionIO[List[Long]] = groups.flatTraverse { case BatchGroup(sql, preps) =>
HC.prepareStatement(sql) {
useConnection { implicit connection =>
Expand All @@ -175,7 +174,7 @@ trait DoobieContextBase[Dialect <: SqlIdiom, Naming <: NamingStrategy]
extractor: Extractor[A],
)(
info: ExecutionInfo,
dc: DatasourceContext,
dc: Runner
): ConnectionIO[List[A]] = groups.flatTraverse {
case BatchGroupReturning(sql, returningBehavior, preps) =>
prepareConnections(returningBehavior)(sql) {
Expand Down Expand Up @@ -206,4 +205,8 @@ trait DoobieContextBase[Dialect <: SqlIdiom, Naming <: NamingStrategy]
override protected def withConnection[A](f: Connection => ConnectionIO[A]): ConnectionIO[A] = ???

protected val effect = null

def wrap[T](t: => T): Free[ConnectionOp, T] = Free.pure(t)
def push[A, B](result: Free[ConnectionOp, A])(f: A => B): Free[ConnectionOp, B] = result.map(f(_))
def seq[A](list: List[Free[ConnectionOp, A]]): Free[ConnectionOp, List[A]] = list.sequence
}

0 comments on commit 9bc0cb7

Please sign in to comment.