doobie now uses GitHub Releases for release notes.
The old log remains below for your enjoyment.
This file summarizes notable changes for each release, but does not describe internal changes unless they are particularly exciting. For complete details please see the corresponding milestones and their associated issues.
Note that tags exist for 0.8.0 and 0.8.1 but there are no artifacts due to various screwups. 0.8.2 is the first release on the 0.8.x series.
This is mostly an upgrade for Cats 2.0 and associated upstream releases. Note that Scala 2.11 is no longer supported, please upgrade!
- Updated to Cats 2.0, along with many other dependency upgrades.
- Added
explainandexplainAnalyzetoQuery[0]/Update[0]with Postgres. See the book chapter on Postgres extensions for more information. - Added syntax so you can say
foo.frinstead offr"$foo".
Contributors for this release include Ben Plommer, Chris Davenport, dantb, deusaquilus, GRYE, Ikrom, Justin Bailey, Nick Hallstrom, Omer Zach, Sam Guymer, Scala Steward, Valy Dia, and Xie Yuheng. Thanks!
This is a compatibility-breaking release, although most source code should compile unmodified.
The big changes are improvements in resource safety:
- Replaced
MonadError-basedguaranteewithbracket, which prevents potential resource leakage when using cancelable IO; and improves transactor resource safety by usingResource. The migration guide contains slightly more information. Thanks Sam Guymer for these updates! Fragmentconcatenation and derived combinators likeFragments.inare now stacksafe, so you can now have giganticINclauses. This required API changes inParam,Fragment,Update[0]andQuery[0]but these should not affect most users.
New features:
- At long last there is a
doobie-quillmodule that allows constructingConnectionIOvalues via Quill quotes. See the new book chapter for examples. Many thanks to Alex Ioffe and Chris Davenport for their assistance!
And an assortment of other improvements:
- Postgis has been upgraded to v2.3.0. Thanks Erlend Hamnaberg!
- Added support for Scala 2.13.0-M5, many thanks to Sam Guymer for setting this up!
TypeTagconstraint onAnalyzablehas been relaxed toWeakTypeTag. Thanks nigredo-tori!- New syntax allows
.transactonOptionTandEitherTofConnectionIO, rolling back in the failure cases. Thanks Julien Truffaut! - Postgres now supports arrays of Scala
BigDecimal. Thanks Nicolas Rémond! - Most calls to
throwhave been replaced withraiseError, which allows doobie to work with effect types that don't catch. Thanks Sam Guymer! - Some things in the build were preventing doobie from cooperating with the community build. This has been fixed, thanks Seth Tisue!
Text[Char]instance was added for PostgresCOPY FROM STDIN. Thanks Dermot Haughey!- You can now create a
HikariTransactorfrom aHikariConfig. Thanks Yuriy Badalyantc! - Thanks to Harry Laoulakos and Daan Hoogenboezem for documentation updates!
Fragmentcombinators now parenthesize arguments so associativity in Scala is reflected in generated SQL. Thanks Katrix!
Many thanks to Arber Shabhasa, Bjørn Madsen, Chris Davenport, Cody Allen, Dmitry Polienko, Kai(luo) Wang, Kevin Walter, Mark Canlas, and Quang Le Hong for their contributions to this release.
❗ This is a major update with breaking changes. Please read the following notes carefully.
Prior to 0.6.x doobie had nothing to say about threading; it was up to users to shift interpreted IO programs onto dedicated pools if desired. This has changed. We now identify three distinct execution contexts that are relevant to database applications.
- All non-blocking work is performed on the execution context identified by
ContextShift[F]. If you are usingIOApp(which you should) this instance is provided for you. All interpreters (and thus all transactors) need this instance on construction. - Requesting a JDBC connection is a blocking operation, so to avoid deadlock these requests cannot be placed in competition with running programs (which need to make progress in order to finish up and return their connections to the pool). Therefore we need a distinct, bounded, blocking execution context for the single purpose of awaiting database connections. All transactors that use a connection pool will require this execution context to be specified.
- All JDBC primitive operations are [potentially] blocking, so we need a distinct, typically unbounded (since the connection context above provides a logical bound) execution context for scheduling these operations. All transactors that use a connection pool will require this execution context to be specified.
For convenience we provide an ExecutionContexts module that provides Resources yielding the kinds of ExecutionContexts that will tend to be useful for the scenarios above. Note that DriverManagerTransactor provides an unbounded number of connections and is unsuitable for production use anyway, so we do not require the blocking pools here (it uses an unbounded pool internally). Fine for testing but don't use it in real life.
See the book chapter on Managing Connections for more information and examples.
In 0.5.x we provided some single-element Streams that would emit values and guarantee resource cleanup. This has been generalized as Resource in cats-effect 1.x, and all such constructors (H2Transactor.newH2Transactor for example) now use Resource rather than Stream. You can use Stream.resource(rsrc) to regain the old functionality if desired.
Prior to the 0.6.x series we provided two typeclasses for bidirectional type mapping:
Metadefined nullable mappings between column/parameter values and scala types.Compositedefined null-safe mappings between column/parameter vectors and scala types.
Starting with version 0.6.0 type mappings are unidirectional:
Metahas been split intoGetandPuttypeclasses, for reads and writes of column/parameter values, respectively.Compositehas been split intoReadandWritetypeclasses, for reads and writes of column/parameter vectors, respecitively.
Note that Meta does still exist, but only as a mechanism for introducing Get/Put pairs. An implicit Meta[A] induces both an implicit Get[A] and an implicit Put[A], and the old mechanism of Meta[A].imap(...)(...) is still supported for this purpose. The xmap method has been replaced with parametric imap and TypeTag-constrained timap. Prefer timap when possible because it yields better diagnostic information when typechecking queries.
To summarize:
| 0.5.x | 0.6.x | Notes |
|---|---|---|
[A: Meta] |
[A: Get : Put] |
Or just one, depending on usage. |
[A: Composite] |
[A: Read : Write] |
Or just one, depending on usage. |
Meta[A].xmap(..) |
Meta[A].timap(...) |
Or imap when a TypeTag is unavailable. |
Composite[A].xmap(...) |
Read[A].map(...) Write[A].contramap(...) |
This takes two steps now. |
Please refer to book chapter on Custom Mappings and the examples project for more details.
- postgres-circe module created exposing Get and Put instances for
io.circe.Json - upgraded to cats-effect 1.0 and fs2 1.0
Minor updates, see below.
- Updated to refined 0.9, fs2 0.10.4, Hikari 3.1.0, ScalaCheck 1.14.0, and Specs2 4.2.0.
- Added
.execWithmethod toFragment, allowing for custom handling of the associated statement. - Added
pureto generated algebras, so you can now sayFC.pure(1)instead of1.pure[ConnectionIO]if you like. Thanks wedens! - Added an example of generic DAOs for simple schemas. See
Orm.scalain theexampleproject. - Minor doc updates.
This is the last planned release in the 0.5.x series. Work will start soon on 0.6!
Minor updates, see below.
- Added experimental support for Blazing Fast™ inserts in Postgres via
COPY ... FROM STDIN. See book Chapter 15 for an example. - Introduced MiMa for checking binary compatibility. Note that for the 0.5.x series we will guarantee compatibility for Scala 2.12 only.
FirstExamplenow actually shows output! Thanks Aaron Hawley.- Added pgEnumStringOpt for transparently partial pgEnum decoding. Thanks Christopher Davenport!
- Added
Composite.deriveComposite[A]()which creates a "semi-automatic" derivation ofComposite[]for a given typeA. While instances are usually derived automatically, this can be used to speed up compilation by only deriving once. It can also be used to avoid needingMeta[]instances in scope or derivable at every site where a givenComposite[A]is used. Thanks Scott Parish!
Minor update to get dependencies up to date.
- Updated to fs2 0.10.2, hikari-cp 2.7.8, and specs2 4.0.3.
- You can now do
.stripMarginon fragments, thanks to Arne Claassen!
This introduces the 0.5.x series which standardizes on cats, cats-effect, and fs2. This is a big release that will make life much simpler for people who were using 0.4.x with cats. See the migration document on the microsite for more information.
Many thanks to Andreas Svanberg, Bjørn Madsen, Charles Hunt, Christopher Davenport, Dale Wijnand, Devin Ekins, Dmitry Polienko, Earl St Sauver, fabio labella, Frank S. Thomas, Hossam Karim, Jisoo Park, Keir Lawson, Mads Hartmann, nigredo-tori, Radu Gancea, sh0hei, Stephen Lazaro, tgalappathth, wedens, and x1- for their contributions to this release!
Notable changes:
- 🎵 Ding, dong the yax is dead! 🎵 The new codebase is based on cats!
- The
-catssegment of artifact names is gone.doobie-coreuses cats now, as does everything else.
- Rather than
foo.imports._for both names and implicits, there are now distinct importsfoo._, foo.implicits._. The oldfoo.imports._still works but is deprecated. - Syntax classes are now organized as in cats. Much cleaner but end users probably won't notice.
Composite[A]now impliesComposite[Option[A]]which is a very useful change. It means joins can be expressed much more easily. SeeJoin.scalain theexampleproject.
- The doc has been ported to sbt-microsites.
FreeGen2code generator now generates all effect types withcats.effect.Asyncinstances, in preparation for transactors that can make use of distinct thread pools for certain operations (JDBC primitives for instance). Free algebras and interpreters for Postgres are also generated now.- Added WartRemover finally.
- The release process is much better, so releases can be more frequent. Version numbers appearing in the doc are now supplied automatically.
This release fixes an issue with HikariTransactor (thanks Naoki Aoyama) and supersedes the botched 0.4.3 release.
This was a failed attempt to add back support for 2.10. Do not use this release.
Sparkly contributors for this release are ✨ n4to4, ✨ Alexa DeWit, ✨ wedens, ✨ Colt Frederickson, ✨ Benjamin Trenker, ✨ nigredo-tori, ✨ Suhas Gaddam, ✨ Christopher Davenport, ✨ Damir Vandic, ✨ Jacob Barber, and 🐔 tpolecat. Noteworthy changes:
- Dropped support for 2.10 because I can't figure out how to publish it.
- Replaced all the
doobie.freeinternals with a new design that makes it practical to write your own interpreter (or, more commonly, subclass the default one) which is very useful for testing and who knows what else. For most users this will not be an observable change. - Switched to a new transactor design that makes it simple to customize behavior, and combined with new interpreter design makes it practical to use doobie types in free coproducts (see
coproduct.scalain theexampleproject). This is a minor breaking change:- The
yolomember onTransactoris no longer stable, so you cannotimport xa.yolo._anymore; instead you must sayval y = xa.yolo; import y._. Because this is typically done withinitialCommandsin sbt it's unlikely to be a big deal. Transactoris now a final case class with an extra type member for the underlying pool or other connection source.
- The
- Note that the interpreter/transactor changes require
Monadinstances at a few more call sites, which should be transparent in most cases but may require Cats users toimport fs2.interop.cats._here and there … if scalac is claiming there's no instance available after upgrading that's probably why. - Added support for type refinements (refined library). See the
doobie-refinedanddoobie-refined-catsmodules. - Added a
failconstructor to all theF*modules. - Made
Meta.nxmapunnecessary and fixed issues with mappings that are undefined for zero values of underlying unboxed types. - Added mapping for Postgres
hstoretype. - Make postgres enums nullable (change
Atominstance toMeta). - Generalized
QueryCheckerandAnalysisSpecto allow any effect type. - Added
streamandstreamWithChunkSizeas fs2 friendly aliases onQuery. - Fix parsing of JDBC type TimestampWithTimezone (introduced in JDK 8).
- Added
Suspendableinstance forPGConnectionIO - Added an
Unknownconstructor toJdbcTypefor JDBC type constants outside the spec and known extensions. - Generalized the underlying structure of
Meta/Compositeand eliminatedAtom. Client code that usesAtomwill need to be re-implemented in terms ofMetaorComposite. - Added
Fragment.const0for constant fragments with no trailing space, whileconstnow does add a trailing space. Users ofFragment.constmay need/wish to change toconst0. Manifestreplaced withTypeTagindoobie.util.invariant.- Improved H2 UUID Support. Query analysis involving H2 and UUIDs should no longer show a type mismatch.
In addition the following libraries were updated:
- sbt 0.13.15
- Scala 2.10.6, 2.11.11, 2.12.3
- scalaz 7.2.9
- PostgreSQL JDBC driver 42.1.1
- Hikari 2.6.1
- Circe 0.8.0
This release updates doobie to Cats 0.9 and the associated fs2-cats interop layer to 0.3, courtesy of mighty space robot Adelbert Chang. There are no other changes.
This was intended to be a quick follow-up to 0.3.0 but it got a little out of hand and turned into a major release. Please read these notes carefully because there are some breaking changes relative to 0.3.0.
Eighteen people contributed to this release, of whom seventeen were not tpolecat. They are sparkly and awesome. In no particular order, many many thanks to ✨ Channing Walton ✨ Daniel Wunsch ✨ Gary Coady ✨ Tristan Lohman ✨ Jisoo Park ✨ Yury Liavitski ✨ Ikhoon Eom ✨ Marek Kadek ✨ Leif Wickland ✨ Zack Powers ✨ Kris Nuttycombe ✨ Pepe García ✨ Peter Neyens ✨ ritschwumm ✨ ronanM ✨ Sam Ritchie ✨ and wedens. ✨
This is probably the most important development for 0.4.0 and it is due in large part to the hard work of ✨ Jisoo Park ✨. Impossibly huge thanks for his work throughout this process.
- doobie is now built natively for Cats with fs2, with no need for a shim/adapter layer. At the moment this is accomplished via a preprocessor.
- All artifacts are built for Cats. Names are suffixed with
-cats, so the scalaz version isdoobie-coreand the Cats version isdoobie-core-cats. - The book of doobie is now published in separate editions for scalaz and Cats.
- There is now support for simple statement logging with timing information. This is not the long-promised structured logging feature but it fits the common use case and fills a clear functional gap. See the book chapter for details and examples.
- The dynamic SQL story is now slightly better with the introduction of composable statement fragments. These allow you to build statements from smaller pieces without having to track parameter placeholders/offsets by hand. See the book chapter for details and examples.
- SQL
INclauses are now handled viaFragments.in, which is a breaking change relative to 0.3.0. See the book chapter on parameterized queries for an example. - Methods on
Query[0]/Update[0]that construct streams (.process) now have variants that allow you to specify the chunk size, which by default is 512 rows. - There is now an
IOdata type that you can use if you're having a hard time settling on a target effect type. It works identically in Cats and scalaz and is what's used in the book.
We cleaned up the add-on modules a bit and made some naming simplifications that are breaking relative to 0.3.0.
- There is now a ScalaTest add-on. See the book chapter on unit testing for details and examples.
- The
contribsegment has been removed from module names, sodoobie-contrib-h2is now justdoobie-h2. It has also been removed from package names. Sodoobie.contrib.h2is now justdoobie.h2. - In both cases the
postgresqlsegment has been shortened topostgres. - All modules now have a consistent import story.
import doobie.<module>.imports._should get you everything you need.
That's it! Enjoy the release. Once again many thanks to our contributors.
This release brings doobie up to date with major dependencies, almost entirely due to the hard work of @guersam. The release is otherwise equivalent to 0.2.4 from a feature standpoint.
Upgrades:
- Updated to scalaz 7.2
- Updated to shapeless 2.3
- Updated to JDK 1.8
- Added build support Scala 2.12
This is a minor release with a few odds and ends and an important library update.
Improvements:
- You can now construct a
HikariTransactorfrom an existingHikariDataSource(thanks @raulraja). - There is now a
.nelaccumulator for non-empty resultsets (thanks @refried). - Arrays of
UUIDs are now supported for PostgreSQL (thanks @veegee). - Published jarfiles now have OSGi headers.
- Some internal cleanup but nothing that should affect end users.
Upgrades:
- Updated to scalaz-stream 0.8 (thanks @guersam).
This release includes more performance work and some usability improvements, as well as documentation improvements here and there. This release should be source-compatible for most users, but is not binary compatible with 0.2.2 or any other release. Let me know if you run into source compatibilty problems. Special thanks to @mdmoss for build improvements, @fommil and @non for help with Sonatype, and everyone else for your continued interest and contributions!
Improvements:
- doobie is now published on Sonatype and no longer requires a Bintray resolver.
- The
freemodules now provide natural transformations of the formFooIO ~> Kleisli[M, Foo, ?]andFoo => FooIO ~> M, which should make life easier when using doobie with existing JDBC resources (your ownConnectionfor example). - New optimized column-vector reads and accumulators for
IListand standard library collections viaCanBuildFromyield performance generally indistinguishable from raw JDBC. TheQuery/Query0operationsto,list, andvectorare now very fast. Result handling viaProcessbenefits to a lesser extent. Compositeinstances are now available for shapeless record types.Atominstances are now available for single-element product types (thanks @wedens and @refried).DriverManagerTransactornow includes constructors corresponding to allgetConnectionmethods onDriverManager.freealgebras and interpreters have been re-implemented to use method dispatch rather than largematchexpressions, resulting in minor performance improvements throughout. This completes the work started in 0.2.2.- The
sqlinterpolator now supports interpolated sequences for SQLINclauses. See Chapter 5 for more information. - The book of doobie now includes a FAQ Chapter.
- The
exampleproject now includes some PostgreSQL CopyManager examples (thanks @wedens).
Big Fixes:
- The PostGIS dependency was pulling in unnecessary transitive dependencies that caused problems with sbt-assembly. This has been fixed.
Upgrades:
- Updated to Scala 2.11.7
- Updated to shapeless 2.2.5
- Updated to scalaz-stream 0.7.2a
- Updated to specs2-core 3.6
- Updated to tut 0.4.0 (build-time dependency only)
- Updated to sbt 0.13.8 (build-time dependency only)
- Updated to kind-projector 0.7.1 (build-time dependency only)
This is another minor release that adds yet more support PostgreSQL-specific features, updates dependencies, and improves performance for resultset processing. Thanks everyone for your continued interest and contributions!
Additions:
- Added
HC.updateManyWithGeneratedKeysand associated syntax onUpdateto allow batch updates to return updated rows. See Chapter 7 for an example. - Added algebras and free monads thereof for PostgreSQL vendor-specific driver APIs, which allows doobie to directly support
LISTEN/NOTIFY,COPY FROM STDINand a number of other interesting features. See Chapter 13 for details and examples.
Improvements:
- Huge improvements to the implementation of the
sqlinterpolator, courtesy of @milessabin. This removes the last remaining arity limit. - Added examples for PostgreSQL-specific error handling combinators. See Chapter 13 for more information.
- Added
Unapplyinstances to make theMonadinstance forFreeCand associated syntax conversions inferrable. For now these are on thedoobie.importsmodule. - Significant performance improvements for resultset processing, with
.listand.vectornow ~4.5x faster and.process~2.5x faster. This work is ongoing.
Upgrades:
- Updated to Scala 2.10.5
- Updated to shapeless 2.2.0 (thanks @milessabin)
- Updated to scalaz-stream 0.7a
- Updated to PostgreSQL JDBC driver 9.4-1201-jdbc41
- Updated to Specs2 3.6 (thanks @etorrebore)
This is a minor follow-up release, primarily to add support for some PostgreSQL features and other odds and ends reported by users. Thanks to users and contributors for their help!
Additions:
- Added
Transactorto wrap an existingDataSource. See Chapter 12 for more information. - Added support for PostGIS and PostgreSQL
enumtypes. See Chapter 13 for more information. - Added combinators for batch updates. See Chapter 7 for more information.
- Added
Compositesupport forHList; anywhere you could map a product or tuple type in 0.2.0 you can now also use a shapelessHList. - Added
Atomsupport forscalaz.Maybe; anywhere you could map anOptiontype in 0.2.0 you can now also useMaybe. - Added
.optionTmethod onQueryandQuery0. - Added an example that exposes a PostgreSQL
NOTIFYchannel as an scalaz-streamProcess.
Improvements:
- The 22-parameter limit on the
sqlinterpolator has been increased to 50, and should go away entirely by 0.3.0 at the latest. There are no other arity limits in doobie. - All
QueryandUpdateconstructions are now supported for typechecking with Specs2 and YOLO mode. - Many improvements in book of doobie.
- Tidied up examples a bit.
Upgrades:
- Updated to Scala 2.11.6.
- Updated to scalaz 7.1.1 and scalaz-stream 0.6a
- Updated to tut 0.3.1 (build only; not user-facing).
- Updated to Specs2 3.9.4
Bug Fixes:
- Fixed problem with typechecking
BOOLEANcolumn mappings. - Fixed driver classloading problem with
HikariTransactor.