Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
1.0.0-RC6 source code.tar.gz | 2024-09-17 | 434.4 kB | |
1.0.0-RC6 source code.zip | 2024-09-17 | 672.0 kB | |
README.md | 2024-09-17 | 13.1 kB | |
Totals: 3 Items | 1.1 MB | 0 |
Query Cancellation
Query cancellation has been implemented via calling PreparedStatement#close()
on fiber cancellation.
Big thanks to @TalkingFoxMid and contributions from @satorg @armanbilge @jatcwang!
Related PRs: [#2079] [#2088]
Opt-in automatic derivation
Automatic derivation has been the (non-configurable) default in Doobie since the start. While convenient, it can lead to long compile times because Read
/Write
/Get
/Put
instances are derived every time it is needed.
For those who want shorter compile times, we have now made automatic derivation opt in!
import doobie.implicits.*
will enable automatic derivation (maintaining source compatibility to ease migration).import doobie.generic.auto.*
to explicitly enable automatic derivation. Compared toimport doobie.implicits.*
this brings just the implicits/givens necessary for automatic derivation- Instances for tuples are still automatically derived for convenience
- To switch to explicitly derived instances, change your
import doobie.implicits.*
toimport doobie.syntax.all.*
and gradually fix compile errors by deriving instances explicitly (see below):
To derive instances explicitly:
Scala 3:
case class Foo(a: String, b: Int) derives Read
Scala 2+:
case class Foo(a: String, b: Int)
object Foo {
implicit val read: Read[Foo] = Read.derived
}
Related PRs: * Opt in auto derivation by @guymers / @jatcwang in https://github.com/tpolecat/doobie/pull/1967 * Fix instance derivation by @jatcwang in https://github.com/tpolecat/doobie/pull/2037 * Make tuple Read/Write instances available without an import by @jatcwang in https://github.com/tpolecat/doobie/pull/2070
Better type-checking with JDBC vendor types (For java.time.*
and more)
In previous releases, doobie typecheck only checks against the int enum returned by java.sql.ResultSetMetaData#getColumnType
(java.sql.Types
). However this is inadequate for two reasons:
java.sql.Types
doesn't cover many other possible database-specific types (e.g. JSON column type)- JDBC drivers often return the wrong
java.sql.Types
, often due to legacy
For example, for a TIMESTAMP WITH TIME ZONE
column Postgres JDBC driver will report that it has the type java.sql.Types.TIMESTAMP
(surprising as java.sql.Types.TIMESTAMP_WITH_TIMEZONE
exists).
PostgreSQL Data Type | getColumnType() | getColumnTypeName() |
---|---|---|
TIMESTAMP | Types.TIMESTAMP | "TIMESTAMP" |
TIMESTAMP WITH TIME ZONE | Types.TIMESTAMP | "TIMESTAMPTZ" |
This means by just using the result from getColumnType
typechecking couldn't differentiate between a TIMESTAMP WITH TIME ZONE
column vs TIMESTAMP (WITHOUT TIMEZONE)
column - which has serious implications for correctness of your program if one uses the wrong column type!
Fortunately, we can see that getColumnTypeName
does differentiate between the two column types.
To help improve typechecking for java.time.*
types (and generally), we have made the following changes:
1. Get
and Put
can now specify vendor column type name
When creating a Get
or Put
instance, the vendor type name can now be specified so typechecking will check against it.
2. Move java.time.*
instances into database modules
java.time.*
instances are moved to their database-specific modules to handle differences in databases and their drivers.
doobie module | import |
---|---|
doobie-postgres | doobie.postgres.implicits.* |
doobie-mysql | doobie.mysql.implicits.* |
For other databases that support Java 8 time types, you can continue to use import doobie.implicits.javatimedrivernative.*
but there's no check against vendor type names.
Related PRs:
- More precise typechecking using vendor types by @jatcwang in https://github.com/tpolecat/doobie/pull/2023
- Improve Java time meta experience by @guymers in https://github.com/tpolecat/doobie/pull/1789
- Add MySQL java.time instances by @jatcwang in https://github.com/tpolecat/doobie/pull/2024
Logging for streaming and updateMany queries
Query
/Update
which now allow queries ran through Query#stream
and Update#withGeneratedKeys
to be logged. As part of this work, doobie.hi.FC
module also have 3 new functions: stream
, executeWithResultSet
and executeWithoutResultSet
. Old functions that does not log (such as doobie.hi.FC.updateWithGeneratedKeys
) has been deprecated and will be removed by 1.0.
Related PRs: * Fix logging for streaming and updateMany by @jatcwang in https://github.com/tpolecat/doobie/pull/2064
Other notable changes
- Allow for different effects of HikariTransactor and its creation by @sideeffffect in https://github.com/tpolecat/doobie/pull/1939
- Split methods for HikariTransactor constructed with two effects by @jatcwang in https://github.com/tpolecat/doobie/pull/1961
- Add parenthesis around each expression in and/or combinator by @jatcwang in https://github.com/tpolecat/doobie/pull/2044
- PostgreSQL Range Types by @tomohavvk in https://github.com/tpolecat/doobie/pull/2008
- Remove lazy initialization of modules to fix potential initialization deadlocks by @jatcwang in https://github.com/tpolecat/doobie/pull/2046
- Add withLogHandler method to Transactor by @sideeffffect in https://github.com/tpolecat/doobie/pull/1977
- Ensure backward compatibility of Hikari Config by @sideeffffect in https://github.com/tpolecat/doobie/pull/1842
- Improve analysis message + Small optimizations https://github.com/typelevel/doobie/pull/2091
- Deprecate non-logging/non-cancelling high-level methods https://github.com/typelevel/doobie/pull/2090
Dependency updates
- Update typelevel plugin and sbt-ghpages by @jatcwang in https://github.com/tpolecat/doobie/pull/1952
- Update sbt-typelevel-ci-release, ... to 0.6.2 by @scala-steward in https://github.com/tpolecat/doobie/pull/1949
- Update postgresql to 42.7.0 by @scala-steward in https://github.com/tpolecat/doobie/pull/1953
- Update sbt-typelevel-ci-release, ... to 0.6.3 by @scala-steward in https://github.com/tpolecat/doobie/pull/1955
- Upgrade postgis to 2023.1.0 / postgres-jdbc to 42.7.1 by @jatcwang in https://github.com/tpolecat/doobie/pull/1962
- Update sbt to 1.9.8 by @scala-steward in https://github.com/tpolecat/doobie/pull/1978
- Update mdoc, sbt-mdoc to 2.5.2 by @scala-steward in https://github.com/tpolecat/doobie/pull/1979
- Update sbt-typelevel-ci-release, ... to 0.6.5 by @scala-steward in https://github.com/tpolecat/doobie/pull/1980
- Update sbt-jmh to 0.4.7 by @scala-steward in https://github.com/tpolecat/doobie/pull/1981
- Update cats-effect, cats-effect-testkit to 3.5.3 by @scala-steward in https://github.com/tpolecat/doobie/pull/1983
- Update specs2-core to 4.20.4 by @scala-steward in https://github.com/tpolecat/doobie/pull/1982
- Update fs2-core, fs2-io to 3.9.4 by @scala-steward in https://github.com/tpolecat/doobie/pull/1984
- Update specs2-core to 4.20.5 by @scala-steward in https://github.com/tpolecat/doobie/pull/1985
- Update refined to 0.11.1 by @scala-steward in https://github.com/tpolecat/doobie/pull/1988
- Update paradox-theme-generic, sbt-paradox to 0.10.6 by @scala-steward in https://github.com/tpolecat/doobie/pull/1987
- Update weaver-cats to 0.8.4 by @scala-steward in https://github.com/tpolecat/doobie/pull/1986
- Update scalatest to 3.2.18 by @scala-steward in https://github.com/tpolecat/doobie/pull/1993
- Update sbt-typelevel-ci-release, ... to 0.6.6 by @scala-steward in https://github.com/tpolecat/doobie/pull/1995
- Update munit to 1.0.0-M11 by @scala-steward in https://github.com/tpolecat/doobie/pull/1992
- Update sbt to 1.9.9 by @scala-steward in https://github.com/tpolecat/doobie/pull/1998
- Update kind-projector to 0.13.3 by @scala-steward in https://github.com/tpolecat/doobie/pull/1999
- Update scala-library, scala-reflect to 2.12.19 by @scala-steward in https://github.com/tpolecat/doobie/pull/2001
- Update sbt-typelevel-ci-release, ... to 0.6.7 by @scala-steward in https://github.com/tpolecat/doobie/pull/2003
- Update scala3-library to 3.3.3 by @scala-steward in https://github.com/tpolecat/doobie/pull/2004
- Update scala-library, scala-reflect to 2.13.13 by @scala-steward in https://github.com/tpolecat/doobie/pull/2002
- Update cats-effect, cats-effect-testkit to 3.5.4 by @scala-steward in https://github.com/tpolecat/doobie/pull/2005
- Update sbt-site to 1.6.0 by @scala-steward in https://github.com/tpolecat/doobie/pull/2009
- Update fs2-core, fs2-io to 3.10.2 by @scala-steward in https://github.com/tpolecat/doobie/pull/2014
- Update postgresql to 42.7.3 by @jatcwang in https://github.com/tpolecat/doobie/pull/2017
- Update paradox-theme-generic, sbt-paradox to 0.10.7 by @scala-steward in https://github.com/tpolecat/doobie/pull/2019
- Update munit to 1.0.0-M12 by @scala-steward in https://github.com/tpolecat/doobie/pull/2021
- Update sbt-typelevel-ci-release, ... to 0.7.0 by @scala-steward in https://github.com/tpolecat/doobie/pull/2025
- Update mysql-connector-j to 8.0.33 by @scala-steward in https://github.com/tpolecat/doobie/pull/2026
- Update mysql-connector-j to 8.3.0 by @scala-steward in https://github.com/tpolecat/doobie/pull/2027
- Update munit to 1.0.0-RC1 by @scala-steward in https://github.com/tpolecat/doobie/pull/2028
- Update sbt to 1.10.0 by @scala-steward in https://github.com/tpolecat/doobie/pull/2032
- Update log4cats-core to 2.7.0 by @scala-steward in https://github.com/tpolecat/doobie/pull/2034
- Update circe-core, circe-generic, ... to 0.14.7 by @scala-steward in https://github.com/tpolecat/doobie/pull/2030
- Update shapeless to 2.3.11 by @scala-steward in https://github.com/tpolecat/doobie/pull/2039
- Update shapeless to 2.3.12 by @scala-steward in https://github.com/tpolecat/doobie/pull/2040
- Update munit to 1.0.0 by @scala-steward in https://github.com/tpolecat/doobie/pull/2041
- Update various plugins and depenencies by @jatcwang in https://github.com/tpolecat/doobie/pull/2045
- Update sbt-typelevel-mergify to 0.7.1 by @scala-steward in https://github.com/tpolecat/doobie/pull/2050
- Update refined to 0.11.2 by @scala-steward in https://github.com/tpolecat/doobie/pull/2051
- Update specs2-core to 4.20.7 by @scala-steward in https://github.com/tpolecat/doobie/pull/2052
- Update mdoc, sbt-mdoc to 2.5.3 by @scala-steward in https://github.com/tpolecat/doobie/pull/2054
- Update scalatest to 3.2.19 by @scala-steward in https://github.com/tpolecat/doobie/pull/2055
- Update circe-core, circe-generic, ... to 0.14.8 by @scala-steward in https://github.com/tpolecat/doobie/pull/2053
- Update specs2-core to 4.20.8 by @scala-steward in https://github.com/tpolecat/doobie/pull/2059
- Update sbt-scoverage to 2.1.0 by @scala-steward in https://github.com/tpolecat/doobie/pull/2058
- Update circe-core, circe-generic, ... to 0.14.9 by @scala-steward in https://github.com/tpolecat/doobie/pull/2057
- Update mysql-connector-j to 9.0.0 by @scala-steward in https://github.com/tpolecat/doobie/pull/2056
- Update mdoc, sbt-mdoc to 2.5.4 by @scala-steward in https://github.com/tpolecat/doobie/pull/2062
- Update sbt, sbt-dependency-tree to 1.10.1 by @scala-steward in https://github.com/tpolecat/doobie/pull/2061
- Update cats-core, cats-free to 2.12.0 by @scala-steward in https://github.com/tpolecat/doobie/pull/2049
- Update sbt-typelevel-ci-release, ... to 0.7.2 by @scala-steward in https://github.com/tpolecat/doobie/pull/2074
Internal/doc changes
- Mergify: Auto merge with merge-when-ci-succeed by @jatcwang in https://github.com/tpolecat/doobie/pull/1954
- Make freeGen2 run manually (but verified by CI) by @jatcwang in https://github.com/tpolecat/doobie/pull/1960
- Cleanup some imports by @jatcwang in https://github.com/tpolecat/doobie/pull/1966
- Cleanup compile warnings in Scala 2 by @jatcwang in https://github.com/tpolecat/doobie/pull/1969
- Xsource:3 and convert code to be more "Scala 3" by @jatcwang in https://github.com/tpolecat/doobie/pull/2066
- Add source:future / better-monaidic-for for irrefutable pattern in for comprehension by @jatcwang in https://github.com/tpolecat/doobie/pull/2069
- docs: related projects by @arturaz in https://github.com/tpolecat/doobie/pull/2071
- [Doc] Explain the F and C in doobie.FC/HC by @jatcwang in https://github.com/tpolecat/doobie/pull/2047
- Small comments for better explanation by @jatcwang in https://github.com/tpolecat/doobie/pull/2038
- expand on hikari example by @jatcwang in https://github.com/tpolecat/doobie/pull/2013
- Add 'scalafmt' to the project by @satorg in https://github.com/tpolecat/doobie/pull/1989
New Contributors
- @tomohavvk made their first contribution in https://github.com/tpolecat/doobie/pull/2008
- @satorg made their first contribution in https://github.com/tpolecat/doobie/pull/1989
Full Changelog: https://github.com/tpolecat/doobie/compare/v1.0.0-RC5...v1.0.0-RC6