Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
wip pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
brbrown25 committed Dec 3, 2020
1 parent 58e2533 commit 2dc1952
Show file tree
Hide file tree
Showing 9 changed files with 1,175 additions and 1,522 deletions.
11 changes: 5 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,10 @@ lazy val core = crossProject(JSPlatform, JVMPlatform)
.settings(buildInfoSettings("zio.sql"))
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-streams" % zioVersion,
"dev.zio" %% "zio-test" % zioVersion % "test",
"dev.zio" %% "zio-test-sbt" % zioVersion % "test",
"org.postgresql" % "postgresql" % "42.2.18" % Compile
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-streams" % zioVersion,
"dev.zio" %% "zio-test" % zioVersion % "test",
"dev.zio" %% "zio-test-sbt" % zioVersion % "test"
)
)
.settings(testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"))
Expand Down Expand Up @@ -203,7 +202,7 @@ lazy val postgres = project
"org.testcontainers" % "database-commons" % testcontainersVersion % Test,
"org.testcontainers" % "postgresql" % testcontainersVersion % Test,
"org.testcontainers" % "jdbc" % testcontainersVersion % Test,
"org.postgresql" % "postgresql" % "42.2.18" % Test,
"org.postgresql" % "postgresql" % "42.2.18" % Compile,
"com.dimafeng" %% "testcontainers-scala-postgresql" % testcontainersScalaVersion % Test
)
)
Expand Down
94 changes: 0 additions & 94 deletions core/jvm/src/main/scala/zio/sql/custom/Interval.scala

This file was deleted.

14 changes: 0 additions & 14 deletions core/jvm/src/main/scala/zio/sql/custom/Timestampz.scala

This file was deleted.

189 changes: 0 additions & 189 deletions core/jvm/src/main/scala/zio/sql/expr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -250,113 +250,6 @@ trait ExprModule extends NewtypesModule with FeaturesModule with OpsModule {
] {
def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]]
}

sealed case class FunctionCall8[F1, F2, F3, F4, F5, F6, F7, F8, A, B, C, D, E, F, G, H, I, Z: TypeTag](
param1: Expr[F1, A, B],
param2: Expr[F2, A, C],
param3: Expr[F3, A, D],
param4: Expr[F4, A, E],
param5: Expr[F5, A, F],
param6: Expr[F6, A, G],
param7: Expr[F7, A, H],
param8: Expr[F8, A, I],
function: FunctionDef[(B, C, D, E, F, G, H, I), Z]
) extends InvariantExpr[
Features.Union[
F1,
Features.Union[
F2,
Features.Union[F3, Features.Union[F4, Features.Union[F5, Features.Union[F6, Features.Union[F7, F8]]]]]
]
],
A,
Z
] {
def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]]
}

sealed case class FunctionCall9[F1, F2, F3, F4, F5, F6, F7, F8, F9, A, B, C, D, E, F, G, H, I, J, Z: TypeTag](
param1: Expr[F1, A, B],
param2: Expr[F2, A, C],
param3: Expr[F3, A, D],
param4: Expr[F4, A, E],
param5: Expr[F5, A, F],
param6: Expr[F6, A, G],
param7: Expr[F7, A, H],
param8: Expr[F8, A, I],
param9: Expr[F9, A, J],
function: FunctionDef[(B, C, D, E, F, G, H, I, J), Z]
) extends InvariantExpr[
Features.Union[
F1,
Features.Union[
F2,
Features.Union[
F3,
Features.Union[F4, Features.Union[F5, Features.Union[F6, Features.Union[F7, Features.Union[F8, F9]]]]]
]
]
],
A,
Z
] {
def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]]
}

sealed case class FunctionCall10[
F1,
F2,
F3,
F4,
F5,
F6,
F7,
F8,
F9,
F10,
A,
B,
C,
D,
E,
F,
G,
H,
I,
J,
K,
Z: TypeTag
](
param1: Expr[F1, A, B],
param2: Expr[F2, A, C],
param3: Expr[F3, A, D],
param4: Expr[F4, A, E],
param5: Expr[F5, A, F],
param6: Expr[F6, A, G],
param7: Expr[F7, A, H],
param8: Expr[F8, A, I],
param9: Expr[F9, A, J],
param10: Expr[F10, A, K],
function: FunctionDef[(B, C, D, E, F, G, H, I, J, K), Z]
) extends InvariantExpr[
Features.Union[
F1,
Features.Union[
F2,
Features.Union[
F3,
Features.Union[F4, Features.Union[
F5,
Features.Union[F6, Features.Union[F7, Features.Union[F8, Features.Union[F9, F10]]]]
]]
]
]
],
A,
Z
] {
def typeTag: TypeTag[Z] = implicitly[TypeTag[Z]]
}
}

sealed case class AggregationDef[-A, +B](name: FunctionName) { self =>
Expand Down Expand Up @@ -474,88 +367,6 @@ trait ExprModule extends NewtypesModule with FeaturesModule with OpsModule {
self.narrow[(P1, P2, P3, P4, P5, P6, P7)]: FunctionDef[(P1, P2, P3, P4, P5, P6, P7), B1]
)

def apply[F1, F2, F3, F4, F5, F6, F7, F8, Source, P1, P2, P3, P4, P5, P6, P7, P8, B1 >: B](
param1: Expr[F1, Source, P1],
param2: Expr[F2, Source, P2],
param3: Expr[F3, Source, P3],
param4: Expr[F4, Source, P4],
param5: Expr[F5, Source, P5],
param6: Expr[F6, Source, P6],
param7: Expr[F7, Source, P7],
param8: Expr[F8, Source, P8]
)(implicit
ev: (P1, P2, P3, P4, P5, P6, P7, P8) <:< A,
typeTag: TypeTag[B1]
): Expr[F1 :||: F2 :||: F3 :||: F4 :||: F5 :||: F6 :||: F7 :||: F8, Source, B1] =
Expr.FunctionCall8(
param1,
param2,
param3,
param4,
param5,
param6,
param7,
param8,
self.narrow[(P1, P2, P3, P4, P5, P6, P7, P8)]: FunctionDef[(P1, P2, P3, P4, P5, P6, P7, P8), B1]
)

def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, Source, P1, P2, P3, P4, P5, P6, P7, P8, P9, B1 >: B](
param1: Expr[F1, Source, P1],
param2: Expr[F2, Source, P2],
param3: Expr[F3, Source, P3],
param4: Expr[F4, Source, P4],
param5: Expr[F5, Source, P5],
param6: Expr[F6, Source, P6],
param7: Expr[F7, Source, P7],
param8: Expr[F8, Source, P8],
param9: Expr[F9, Source, P9]
)(implicit
ev: (P1, P2, P3, P4, P5, P6, P7, P8, P9) <:< A,
typeTag: TypeTag[B1]
): Expr[F1 :||: F2 :||: F3 :||: F4 :||: F5 :||: F6 :||: F7 :||: F8 :||: F9, Source, B1] =
Expr.FunctionCall9(
param1,
param2,
param3,
param4,
param5,
param6,
param7,
param8,
param9,
self.narrow[(P1, P2, P3, P4, P5, P6, P7, P8, P9)]: FunctionDef[(P1, P2, P3, P4, P5, P6, P7, P8, P9), B1]
)

def apply[F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, Source, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, B1 >: B](
param1: Expr[F1, Source, P1],
param2: Expr[F2, Source, P2],
param3: Expr[F3, Source, P3],
param4: Expr[F4, Source, P4],
param5: Expr[F5, Source, P5],
param6: Expr[F6, Source, P6],
param7: Expr[F7, Source, P7],
param8: Expr[F8, Source, P8],
param9: Expr[F9, Source, P9],
param10: Expr[F10, Source, P10]
)(implicit
ev: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) <:< A,
typeTag: TypeTag[B1]
): Expr[F1 :||: F2 :||: F3 :||: F4 :||: F5 :||: F6 :||: F7 :||: F8 :||: F9 :||: F10, Source, B1] =
Expr.FunctionCall10(
param1,
param2,
param3,
param4,
param5,
param6,
param7,
param8,
param9,
param10,
self
.narrow[(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)]: FunctionDef[(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10), B1]
)

def narrow[C](implicit ev: C <:< A): FunctionDef[C, B] = {
val _ = ev
self.asInstanceOf[FunctionDef[C, B]]
Expand Down
9 changes: 5 additions & 4 deletions core/jvm/src/main/scala/zio/sql/typetag.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package zio.sql
import java.time._
import java.util.UUID
import zio.Chunk
import zio.sql.custom.{ Interval, Timestampz }

trait TypeTagModule {

Expand Down Expand Up @@ -34,9 +33,9 @@ trait TypeTagModule {
implicit case object TString extends NotNull[String]
implicit case object TUUID extends NotNull[UUID]
implicit case object TZonedDateTime extends NotNull[ZonedDateTime]
implicit case object TInterval extends NotNull[Interval]
implicit case object TTimestampz extends NotNull[Timestampz]
sealed case class TDialectSpecific[+A](typeTagExtension: TypeTagExtension[A]) extends NotNull[A]
sealed case class TDialectSpecific[+A](typeTagExtension: TypeTagExtension[A]) extends NotNull[A] {
def decode[A]: Either[Int, String] => A = ???
}

sealed case class Nullable[A: NotNull]() extends TypeTag[Option[A]] {
def typeTag: TypeTag[A] = implicitly[TypeTag[A]]
Expand Down Expand Up @@ -79,4 +78,6 @@ trait TypeTagModule {
implicit case object TDoubleIsNumeric extends AbstractIsNumeric[Double]
implicit case object TBigDecimalIsNumeric extends AbstractIsNumeric[BigDecimal]
}

type PostgresTypeTagExtension
}
Loading

0 comments on commit 2dc1952

Please sign in to comment.