Skip to content

Commit ebd848e

Browse files
authored
Merge branch 'master' into mutable-ArrayEncoders
2 parents 214e1a9 + 5a5b8ae commit ebd848e

11 files changed

Lines changed: 92 additions & 40 deletions

File tree

.github/workflows/scala-steward.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
name: Scala Steward
1414
steps:
1515
- name: Scala Steward
16-
uses: scala-steward-org/scala-steward-action@v2.75.0
16+
uses: scala-steward-org/scala-steward-action@v2.76.0
1717
with:
1818
github-app-id: ${{ secrets.SCALA_STEWARD_GITHUB_APP_ID }}
1919
github-app-installation-id: ${{ secrets.SCALA_STEWARD_GITHUB_APP_INSTALLATION_ID }}

build.sbt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@ lazy val `quill-engine` =
200200
.settings(commonSettings: _*)
201201
.settings(
202202
libraryDependencies ++= Seq(
203-
"com.typesafe" % "config" % "1.4.3",
203+
"com.typesafe" % "config" % "1.4.4",
204204
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.5",
205205
("com.github.takayahilton" %% "sql-formatter" % "1.2.1").cross(CrossVersion.for3Use2_13),
206206
"io.suzaku" %% "boopickle" % "1.5.0",
207-
"com.lihaoyi" %% "pprint" % "0.9.0",
208-
"com.github.ben-manes.caffeine" % "caffeine" % "3.2.0"
207+
"com.lihaoyi" %% "pprint" % "0.9.3",
208+
"com.github.ben-manes.caffeine" % "caffeine" % "3.2.2"
209209
),
210210
coverageExcludedPackages := "<empty>;.*AstPrinter;.*Using;io.getquill.Model;io.getquill.ScalarTag;io.getquill.QuotationTag"
211211
)
@@ -216,8 +216,8 @@ lazy val `quill-core` =
216216
.settings(commonSettings: _*)
217217
.settings(
218218
libraryDependencies ++= Seq(
219-
"com.typesafe" % "config" % "1.4.3",
220-
"dev.zio" %% "zio-logging" % "2.5.0",
219+
"com.typesafe" % "config" % "1.4.4",
220+
"dev.zio" %% "zio-logging" % "2.5.1",
221221
"dev.zio" %% "zio" % Version.zio,
222222
"dev.zio" %% "zio-streams" % Version.zio,
223223
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.5"
@@ -423,8 +423,8 @@ lazy val `quill-jdbc-zio` =
423423
.settings(
424424
libraryDependencies ++= Seq(
425425
// Needed for PGObject in JsonExtensions but not necessary if user is not using postgres
426-
"org.postgresql" % "postgresql" % "42.7.5" % "provided",
427-
"dev.zio" %% "zio-json" % "0.7.43"
426+
"org.postgresql" % "postgresql" % "42.7.7" % "provided",
427+
"dev.zio" %% "zio-json" % "0.7.44"
428428
),
429429
Test / testGrouping := {
430430
(Test / definedTests).value map { test =>
@@ -511,7 +511,7 @@ lazy val `quill-orientdb` =
511511
.settings(
512512
Test / fork := true,
513513
libraryDependencies ++= Seq(
514-
"com.orientechnologies" % "orientdb-graphdb" % "3.2.39"
514+
"com.orientechnologies" % "orientdb-graphdb" % "3.2.42"
515515
)
516516
)
517517
.dependsOn(
@@ -532,11 +532,11 @@ lazy val `quill-test-kit` =
532532

533533
lazy val jdbcTestingLibraries = Seq(
534534
libraryDependencies ++= Seq(
535-
"com.zaxxer" % "HikariCP" % "6.3.0" exclude ("org.slf4j", "*"),
536-
"com.mysql" % "mysql-connector-j" % "9.3.0" % Test,
535+
"com.zaxxer" % "HikariCP" % "6.3.1" exclude ("org.slf4j", "*"),
536+
"com.mysql" % "mysql-connector-j" % "9.4.0" % Test,
537537
"com.h2database" % "h2" % "2.3.232" % Test,
538-
"org.postgresql" % "postgresql" % "42.7.5" % Test,
539-
"org.xerial" % "sqlite-jdbc" % "3.49.1.0" % Test,
538+
"org.postgresql" % "postgresql" % "42.7.7" % Test,
539+
"org.xerial" % "sqlite-jdbc" % "3.50.3.0" % Test,
540540
"com.microsoft.sqlserver" % "mssql-jdbc" % "7.4.1.jre11" % Test,
541541
"com.oracle.ojdbc" % "ojdbc8" % "19.3.0.0" % Test,
542542
"org.mockito" %% "mockito-scala-scalatest" % "1.17.14" % Test

project/Dependencies.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import sbt.*
22
import sbt.Keys.*
33

44
object Version {
5-
val zio = "2.1.16"
5+
val zio = "2.1.20"
66
}
77

88
sealed trait ExcludeTests

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.11.0
1+
sbt.version=1.11.4

project/plugins.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releas
44

55
addDependencyTreePlugin
66

7-
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.4")
7+
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.5")
88
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.3.1")
99
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.4")
1010
addSbtPlugin("com.etsy" % "sbt-compile-quick-plugin" % "1.4.0")
1111
addSbtPlugin("dev.zio" % "zio-sbt-website" % "0.3.10")
12-
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.11.0")
12+
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.11.1")

quill-engine/src/main/scala/io/getquill/idiom/ReifyStatement.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ object ReifyStatement {
6565
val separators = List.fill(liftings.size - 1)(`, `)
6666
tokens ++= (stmt"$a $op (" +: Interleave(liftings, separators) :+ `)`)
6767
}
68+
case (tokens, ScalarLiftToken(lift: ScalarQueryLift)) =>
69+
val liftings = lift.value.asInstanceOf[Iterable[Any]]
70+
.toList
71+
.map(v => ScalarLiftToken(ScalarValueLift(lift.name, External.Source.Parser, v, lift.encoder, lift.quat)))
72+
val separators = List.fill(liftings.size - 1)(`, `)
73+
tokens ++= Interleave(liftings, separators)
6874
case (tokens, token) =>
6975
tokens += token
7076
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package io.getquill.context.jdbc.h2
2+
3+
import io.getquill.context.sql.encoding.ArrayEncodingBaseSpec
4+
5+
import java.sql.Timestamp
6+
7+
class ArrayJdbcEncodingSpec extends ArrayEncodingBaseSpec {
8+
val ctx = testContext
9+
import ctx._
10+
11+
val q = quote(query[ArraysTestEntity])
12+
val corrected = e.copy(timestamps = e.timestamps.map(d => new Timestamp(d.getTime)))
13+
14+
override protected def beforeEach(): Unit = {
15+
ctx.run(q.delete)
16+
()
17+
}
18+
19+
"Support all sql base types and `Seq` implementers" in {
20+
ctx.run(q.insertValue(lift(corrected)))
21+
val actual = ctx.run(q).head
22+
actual mustEqual corrected
23+
baseEntityDeepCheck(actual, corrected)
24+
}
25+
26+
"Support Seq encoding basing on MappedEncoding" in {
27+
val wrapQ = quote(querySchema[WrapEntity]("ArraysTestEntity"))
28+
ctx.run(wrapQ.insertValue(lift(wrapE)))
29+
ctx.run(wrapQ).head.texts mustBe wrapE.texts
30+
}
31+
32+
"empty array on found null" in {
33+
case class ArraysTestEntity(texts: Option[List[String]])
34+
ctx.run(query[ArraysTestEntity].insertValue(lift(ArraysTestEntity(None))))
35+
36+
case class E(texts: List[String])
37+
ctx.run(querySchema[E]("ArraysTestEntity")).headOption.map(_.texts) mustBe Some(Nil)
38+
}
39+
40+
}

quill-jdbc-zio/src/test/scala/io/getquill/mock/ZioMockSpec.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ class ZioMockSpec extends AnyFreeSpec with MockitoSugar { // with AsyncMockitoSu
148148
}.getOrThrow()
149149
}
150150

151-
resultMsg.contains("fiber") mustBe true
152151
resultMsg.contains(msg) mustBe true
153152

154153
// In test suite verifications come after
@@ -188,7 +187,6 @@ class ZioMockSpec extends AnyFreeSpec with MockitoSugar { // with AsyncMockitoSu
188187
}.getOrThrow()
189188
}
190189

191-
resultMsg.contains("fiber") mustBe true
192190
resultMsg.contains(msg) mustBe true
193191

194192
// In test suite verifications come after

quill-jdbc/src/main/scala/io/getquill/context/jdbc/SimplifiedContexts.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ trait H2JdbcTypes[+D <: H2Dialect, +N <: NamingStrategy]
3232
with ObjectGenericTimeEncoders
3333
with ObjectGenericTimeDecoders
3434
with BooleanObjectEncoding
35-
with UUIDObjectEncoding {
35+
with UUIDObjectEncoding
36+
with ArrayDecoders
37+
with ArrayEncoders {
3638

3739
val idiom: D
3840
}

quill-jdbc/src/test/resources/sql/h2-schema.sql

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ CREATE TABLE IF NOT EXISTS Task(
2323
tsk VARCHAR(255)
2424
);
2525

26-
CREATE TABLE TimeEntity(
26+
CREATE TABLE IF NOT EXISTS TimeEntity(
2727
sqlDate DATE, -- java.sql.Date
2828
sqlTime TIME, -- java.sql.Time
2929
sqlTimestamp TIMESTAMP, -- java.sql.Timestamp
@@ -46,7 +46,7 @@ CREATE TABLE IF NOT EXISTS EncodingTestEntity(
4646
v6 INTEGER,
4747
v7 BIGINT,
4848
v8 FLOAT,
49-
v9 DOUBLE PRECISIOn,
49+
v9 DOUBLE PRECISION,
5050
v10 BYTEA,
5151
v11 TIMESTAMP,
5252
v12 VARCHAR(255),
@@ -60,7 +60,7 @@ CREATE TABLE IF NOT EXISTS EncodingTestEntity(
6060
o6 INTEGER,
6161
o7 BIGINT,
6262
o8 FLOAT,
63-
o9 DOUBLE PRECISIOn,
63+
o9 DOUBLE PRECISION,
6464
o10 BYTEA,
6565
o11 TIMESTAMP,
6666
o12 VARCHAR(255),
@@ -99,19 +99,19 @@ CREATE TABLE IF NOT EXISTS Product(
9999
sku BIGINT
100100
);
101101

102-
CREATE TABLE IF NOT EXISTS Contact(
103-
firstName VARCHAR(255),
104-
lastName VARCHAR(255),
105-
age int,
106-
addressFk int,
107-
extraInfo VARCHAR(255)
108-
);
109-
110-
CREATE TABLE IF NOT EXISTS Address(
111-
id int,
112-
street VARCHAR(255),
113-
zip int,
114-
otherExtraInfo VARCHAR(255)
102+
CREATE TABLE IF NOT EXISTS ArraysTestEntity (
103+
texts VARCHAR(255) ARRAY,
104+
decimals DECIMAL(5,2) ARRAY,
105+
bools BOOLEAN ARRAY,
106+
bytes TINYINT ARRAY,
107+
shorts SMALLINT ARRAY,
108+
ints INT ARRAY,
109+
longs BIGINT ARRAY,
110+
floats FLOAT ARRAY,
111+
doubles DOUBLE PRECISION ARRAY,
112+
timestamps TIMESTAMP ARRAY,
113+
dates DATE ARRAY,
114+
uuids UUID ARRAY
115115
);
116116

117117
CREATE TABLE IF NOT EXISTS Contact(

0 commit comments

Comments
 (0)