{"id":13412358,"url":"https://github.com/go-kivik/kivik","last_synced_at":"2025-12-25T04:16:41.481Z","repository":{"id":38802994,"uuid":"81457136","full_name":"go-kivik/kivik","owner":"go-kivik","description":"Common interface to CouchDB or CouchDB-like databases for Go and GopherJS","archived":false,"fork":false,"pushed_at":"2024-04-25T15:04:29.000Z","size":3900,"stargazers_count":296,"open_issues_count":34,"forks_count":42,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-25T15:05:50.149Z","etag":null,"topics":["couchdb","database","go","gopherjs-bindings","nosql","pouchdb"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/go-kivik.png","metadata":{"files":{"readme":"README.md","changelog":"changes.go","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-2.0","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"security.go","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-09T14:14:54.000Z","updated_at":"2024-05-10T16:20:20.398Z","dependencies_parsed_at":"2023-10-14T21:18:40.254Z","dependency_job_id":"4caf58f9-b0df-4baf-abfb-3a7e4d54a497","html_url":"https://github.com/go-kivik/kivik","commit_stats":null,"previous_names":["flimzy/kivik","flimzy/sofadb"],"tags_count":57,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-kivik%2Fkivik","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-kivik%2Fkivik/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-kivik%2Fkivik/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-kivik%2Fkivik/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-kivik","download_url":"https://codeload.github.com/go-kivik/kivik/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221495291,"owners_count":16832454,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["couchdb","database","go","gopherjs-bindings","nosql","pouchdb"],"created_at":"2024-07-30T20:01:23.823Z","updated_at":"2025-12-25T04:16:36.440Z","avatar_url":"https://github.com/go-kivik.png","language":"Go","funding_links":[],"categories":["Database","数据库驱动程序","Go","Database Drivers","Data Integration Frameworks","数据库  `go语言实现的数据库`","数据库","Uncategorized","Generators"],"sub_categories":["Advanced Console UIs","关系数据库驱动程序","NoSQL数据库驱动程序","NoSQL Database Drivers","标准 CLI","Relational Database Drivers"],"readme":"[![Build Status](https://gitlab.com/go-kivik/kivik/badges/master/pipeline.svg)](https://gitlab.com/go-kivik/kivik/pipelines) [![Codecov](https://img.shields.io/codecov/c/github/go-kivik/kivik.svg?style=flat)](https://codecov.io/gh/go-kivik/kivik) [![Go Report Card](https://goreportcard.com/badge/github.com/go-kivik/kivik)](https://goreportcard.com/report/github.com/go-kivik/kivik) [![Go Reference](https://pkg.go.dev/badge/github.com/go-kivik/kivik/v4.svg)](https://pkg.go.dev/github.com/go-kivik/kivik/v4) [![Website](https://img.shields.io/website-up-down-green-red/http/kivik.io.svg?label=website\u0026colorB=007fff)](http://kivik.io)\n\n# Kivik\n\nPackage kivik provides a common interface to CouchDB or CouchDB-like databases.\n\nThe kivik package must be used in conjunction with a database driver.\n\nThe kivik driver system is modeled after the standard library's [sql](https://golang.org/pkg/database/sql/)\nand [sql/driver](https://golang.org/pkg/database/sql/driver/) packages, although\nthe client API is completely different due to the different database models\nimplemented by SQL and NoSQL databases such as CouchDB.\n\n# Versions\n\nYou are browsing the current **stable** branch of Kivik, v4. If you are upgrading\nfrom the previous stable version, v3, [read the list of breaking changes](#changes-from-3x-to-4x).\n\nExample configuration for common dependency managers follow.\n\n## Go Modules\n\nKivik 3.x and later supports Go modules, which is the recommended way to use it\nfor Go version 1.11 or newer. Kivik 4.x only supports Go 1.17 and later. If your\nproject is already using Go modules, simply fetch the desired version:\n\n```shell\ngo get github.com/go-kivik/kivik/v4\n```\n\n# Installation\n\nInstall Kivik as you normally would for any Go package:\n\n    go get -u github.com/go-kivik/kivik/v4\n\nThis will install the main Kivik package and the CouchDB database driver. Three officially supported drivers are shipped with this Go module:\n\n  - CouchDB: [github.com/go-kivik/kivik/v4/couchdb](https://pkg.go.dev/github.com/go-kivik/kivik/v4/couchdb)\n  - PouchDB: [github.com/go-kivik/kivik/v4/pouchdb](https://pkg.go.dev/github.com/go-kivik/kivik/v4/pouchdb) (requires GopherJS)\n  - MockDB: [github.com/go-kivik/kivik/v4/mockdb](https://pkg.go.dev/github.com/go-kivik/kivik/v4/mockdb)\n\nIn addition, there are partial/experimental drivers available:\n\n  - FilesystemDB: [github.com/go-kivik/kivik/v4/x/fsdb](https://pkg.go.dev/github.com/go-kivik/kivik/v4/x/fsdb)\n  - MemoryDB: [github.com/go-kivik/kivik/v4/x/memorydb](https://pkg.go.dev/github.com/go-kivik/kivik/v4/x/memorydb)\n  - SQLite: [github.com/go-kivik/kivik/x/sqlite/v4](https://pkg.go.dev/github.com/go-kivik/kivik/x/sqlite/v4)\n\n# CLI\n\nConsult the [CLI README](https://github.com/go-kivik/kivik/blob/master/cmd/kivik/README.md) for full details on the `kivik` CLI tool.\n\n# Example Usage\n\nPlease consult the the [package documentation](https://pkg.go.dev/github.com/go-kivik/kivik/v4)\nfor all available API methods, and a complete usage documentation, and usage examples.\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n\n    kivik \"github.com/go-kivik/kivik/v4\"\n    _ \"github.com/go-kivik/kivik/v4/couchdb\" // The CouchDB driver\n)\n\nfunc main() {\n    client, err := kivik.New(\"couch\", \"http://localhost:5984/\")\n    if err != nil {\n        panic(err)\n    }\n\n    db := client.DB(\"animals\")\n\n    doc := map[string]interface{}{\n        \"_id\":      \"cow\",\n        \"feet\":     4,\n        \"greeting\": \"moo\",\n    }\n\n    rev, err := db.Put(context.TODO(), \"cow\", doc)\n    if err != nil {\n        panic(err)\n    }\n    fmt.Printf(\"Cow inserted with revision %s\\n\", rev)\n}\n```\n\n# Frequently Asked Questions\n\nNobody has ever asked me any of these questions, so they're probably better called\n\"Never Asked Questions\" or possibly \"Imagined Questions.\"\n\n## Why another CouchDB client API?\n\nI had a number of specific design goals when creating this package:\n\n- Provide a generic database API for a variety of CouchDB-like databases. The previously existing drivers for CouchDB had patchy support for different versions of CouchDB, and different subsets of functionality.\n- Work equally well with CouchDB 1.6, 2.x, 3.x, and any future versions, as well as PouchDB.\n- Be as Go-idiomatic as possible.\n- Be unambiguously open-source. Kivik is released under the Apache license, same as CouchDB and PouchDB.\n- Separate out the basic implementation of a database driver (implementing the `kivik/driver` interfaces) vs the implementation of all the user-level types and convenience methods. It ought to be reasonably easy to create a new driver, for testing, mocking, implementing a new backend data storage system, or talking to other CouchDB-like databases.\n\n## What are Kivik's requirements?\n\nKivik's test suite is automatically run on Linux for every pull request, but\nshould work on all supported Go architectures. If you find it not working for\nyour OS/architecture, please submit a bug report.\n\nBelow are the compatibility targets for specific runtime and database versions.\nIf you discover a bug affecting any of these supported environments, please let\nme know by submitting a bug report via GitHub.\n\n- **Go** Kivik 4.x aims for full compatibility with all stable releases of Go\n  from 1.13. For Go 1.7 or 1.8 you can use [Kivik 1.x](https://github.com/go-kivik/kivik/tree/v1).\n  For Go 1.9 through 1.12, you can use [Kivik 3.x](https://github.com/go-kivik/kivik/tree/v3).\n- **CouchDB** The Kivik 4.x CouchDB driver aims for compatibility with all\n  stable releases of CouchDB from 2.x.\n- **GopherJS** GopherJS always requires the latest stable version of Go, so\n  building Kivik with GopherJS has this same requirement.\n- **PouchDB** The Kivik 4.x PouchDB driver aims for compatibility with all\n  stable releases of PouchDB from 8.0.0.\n\n## What is the development status?\n\nKivik 4.x is stable, and suitable for production use.\n\n## Why the name \"Kivik\"?\n\n[Kivik](http://www.ikea.com/us/en/catalog/categories/series/18329/) is a line\nof sofas (couches) from IKEA. And in the spirit of IKEA, and build-your-own\nfurniture, Kivik aims to allow you to \"build your own\" CouchDB client, server,\nand proxy applications.\n\n## What license is Kivik released under?\n\nKivik is Copyright 2017-2023 by the Kivik contributors, and is released under the\nterms of the Apache 2.0 license. See [LICENCE](LICENSE) for the full text of the\nlicense.\n\n### Changes from 3.x to 4.x\n\nThis is a partial list of breaking changes between 3.x and 4.x\n\n- Options are no longer a simple `map[string]interface{}`, but are rather functional parameters. In most cases, you can just use `kivik.Param(key, value)`, or `kivik.Params(map[string]interface{}{key: value})` as a replacement. Some shortcuts for common params now exist, and driver-specific options may work differently. Consult the GoDoc.\n- The `Authenticate` method has been removed. Authentication is now handled via option parameters.\n- The CouchDB, PouchDB, and MockDB drivers, and the experimental FilesystemDB and MemoryDB drivers, have been merged with this repo, rather than being hosted in separate repos. For v3 you would have imported `github.com/go-kivik/couchdb/v3`, for example. With v4, you instead use `github.com/go-kivik/kivik/v4/couchdb` for CouchDB, or `github.com/go-kivik/kivik/v4/x/fsdb` for the experimental FilesystemDB driver.\n- The return type for queries has been significantly changed.\n  - In 3.x, queries returned a `*Rows` struct. Now they return a `*ResultSet`.\n  - The `Offset()`, `TotalRows()`, `UpdateSeq()`, `Warning()` and `Bookmark()` methods have been removed, and replaced with the `ResultMetadata` type which is accessed via the `Metadata()` method. See [issue #552](https://github.com/go-kivik/kivik/issues/552).\n  - Calling most methods on `ResultSet` will now work after closing the iterator.\n  - The new `ResultSet` type supports multi-query mode, which is triggered by calling `NextResultSet` before `Next`.\n  - `Key`, `ID`, `Rev`, `Attachments` all now return row-specific errors, and `ScanKey` may successfully decode while also returning a row-specific error.\n- The `Changes` type has been changed to semantically match the `ResultSet` type. Specifically, the `LastSeq()` and `Pending()` methods have been replaced by the `Metadata()` method.\n- The `DBUpdates()` and `Changes()` methods now defer errors to the iterator, for easier chaining and consistency with other iterators.\n- `DB.BulkDocs()` no longer returns an iterator, but rather an array of all results.\n- `Get` now returns a simpler `*Result` type than before.\n- `GetMeta` has been replaced with `GetRev`, and no longer claims to return the document size. The document size was never _really_ the document size, rather it is the `Content-Length` field of the HTTP response, which can vary depending on query parameters, making its use for determining document size dubious at best.\n- The `StatusCode() int` method on errors has been renamed to `HTTPStatus() int`, to be more descriptive. The related package function `StatusCode(error) int` has also been renamed to `HTTPStatus(error) int` to match.\n- `Client.Close()` and `DB.Close()` now block until any relevant calls have returned.\n- `Client.Close()` and `DB.Close()` no longer take a `context.Context` value. These operations cannot actually be canceled anyway, by the one driver that uses them (PouchDB); it only stops waiting. It makes more senes to make these functions blocking indefinitely, especially now that they wait for client requests to finish, and let the caller stop waiting if it wants to.\n\n#### CouchDB specific changes\n\n- The `SetTransport` authentication method has been removed, as a duplicate of [couchdb.OptionHTTPClient](https://pkg.go.dev/github.com/go-kivik/kivik/v4/couchdb#OptionHTTPClient).\n- Options passed to Kivik functions are now functional options, rather than a map of string to empty interface. As such, many of the options have changed. Consult the relevant GoDoc.\n\n#### New features and additions\n\n- Kivik now ships with the `kivik` command line tool (previously part of the `github.com/go-kivik/xkivik` repository).\n- The new [Replicate](https://pkg.go.dev/github.com/go-kivik/kivik/v4#Replicate) function allows replication between arbitrary databases, such as between CouchDB and a directory structure using the FilesystemDB.\n\n## What projects currently use Kivik?\n\nIf your project uses Kivik, and you'd like to be added to this list, create an\nissue or submit a pull request.\n\n- [Cayley](https://github.com/cayleygraph/cayley) is an open-source graph\n  database. It uses Kivik for the CouchDB and PouchDB storage backends.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-kivik%2Fkivik","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-kivik%2Fkivik","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-kivik%2Fkivik/lists"}