CouchDB and PouchDB library for Go
Kivik provides a common Go and GopherJS client library for CouchDB, PouchDB, and similar databases.
package main
import "context"
import "github.com/go-kivik/kivik/v3"
import _ "github.com/go-kivik/couchdb/v3" // The CouchDB driver
func main() {
dsn := "http://localhost:5984"
client, err := kivik.New(context.TODO(), "couch", dsn)
if err != nil {
panic(err)
}
// ...
}
What is Kivik?
Kivik is a common interface to CouchDB and CouchDB-like databases for Go and GopherJS.
Kivik's driver architecture is modeled after the Go standard library's sql and sql/driver packages. This allows for the addition of arbitrary backend drivers, while maintaining API compatibility.
A primary goal of Kivik is to provide a common interface to both CouchDB in Go, and PouchDB in GopherJS.
Install Kivik and the CouchDB driver to get started:
go get -u github.com/go-kivik/kivik/v3 go get -u github.com/go-kivik/couchdb/v3
Then follow the Usage Examples, or read the GoDoc, or visit the project page on GitHub.
Community
Kivik is primarily developed by Jonathan Hall, but many others have contributed.
We have recently created the #kivik channel on Gophers Slack (invites here). Come join the discussion!
Go
Kivik is tested against all versions of Go from 1.7.
CouchDB
Kivik's couchdb driver works with all stable releases of CouchDB from 1.6.1.
GopherJS
Kivik works with the latest release of GopherJS.
PouchDB
Kivik's pouchdb driver works with all stable versions of PouchDB from 6.0.0, when built using GopherJS.