Kivik 2.0.0-pre1 Released

The long-awaited Kivik 2.0.0 is nearing release

Jun 9, 2019 • Jonathan Hall

I’m happy to announce that Kivik v2.0.0-pre1 has now been tagged! This version number applies to the following public packages:

This new version includes a few major enhancements, as well as a much larger number of minor changes. Some of these changes break backward compatibility with the v1 series, so some care must be taken when upgrading.

An overview of the biggest changes to each package is below.

  • Various API changes, to improve usability. When upgrading from v1, you will notice compilation errors where function signatures have changes, but the necessary changes should be pretty self-explanatory.
  • Improved error reporting. Go 1.13 will have some new standard error features. Prior to the Go 1.13 release, these features are available with the golang.org/x/xerrors package. Kivik v2.0.0 takes advantage of these enhancements. Some error values are still subject to change prior to the final release of Kivik v2.0.0.
  • A new driver, kivikmock has been added. Inspired by go-sqlmock, this driver allows mocking all database requests, for use in automated tests.
  • When querying views (via Query(), AllDocs(), or similar), key-related fields are now JSON-encoded by Kivik. This simplifies the use of this endpoint, but is a breaking change, as previously, raw JSON objects were required. You may still pass a raw JSON object by passing a key of type json.RawMessage.
  • Began switching to strictly using http.Status* codes, rather than kivik-specific ones.
  • The Changes() method was modified to support all supported modes (except eventsource). Previously, only continuous mode was supported.
  • The Attachment type was completely rewritten.
  • BulkGet() support was added, to call the /db/_bulk_get endpoint.
  • Ping() support was added, which queries the new /_up endpoint, when available, to report that the database is ready or not.
  • DBsStats() support was added, to query the new /_dbs_info endpoint.
  • The User-Agent string is now set for outbound requests
  • Purge() support was added, to query the /db/_purge endpoint.
  • DesignDocs() and LocalDocs() support was added, to call the new /db/_design_docs and /db/_local_docs endpoints respectively.
  • When calling Get(), if attachments are returned, they are now returned with a new, experimental AttachmentsIterator, to allow for more efficient retrieval of attachments from CouchDB, using multipart/related data rather than Base64-encoded binary attachments.

The final version of Kivik 2.0.0 should be released in aproximately 30 days.