Go client for TiKV
Go to file
disksing e1c2e9cab5
all tests run in serial (#150)
Signed-off-by: disksing <i@disksing.com>
2021-06-23 15:46:42 +08:00
.github branch name related changes (#146) 2021-06-23 12:07:37 +08:00
client all tests run in serial (#150) 2021-06-23 15:46:42 +08:00
config config: replace pingcap/check with testify (#136) 2021-06-22 13:13:47 +08:00
error update license (#110) 2021-06-22 10:29:28 +08:00
examples examples/rawkv: add example for rawkv (#104) 2021-06-22 11:06:35 +08:00
integration_tests all tests run in serial (#150) 2021-06-23 15:46:42 +08:00
kv Add PrefixNextKey API (#105) (#106) 2021-06-22 17:47:15 +08:00
latch update license (#110) 2021-06-22 10:29:28 +08:00
locate all tests run in serial (#150) 2021-06-23 15:46:42 +08:00
logutil update license (#110) 2021-06-22 10:29:28 +08:00
metrics update license (#110) 2021-06-22 10:29:28 +08:00
mockstore all tests run in serial (#150) 2021-06-23 15:46:42 +08:00
oracle oracle: replace pingcap/check with testify (#137) 2021-06-22 17:41:57 +08:00
retry retry: replace pingcap/check with testify (#140) 2021-06-22 14:33:54 +08:00
tikv all tests run in serial (#150) 2021-06-23 15:46:42 +08:00
tikvrpc all tests run in serial (#150) 2021-06-23 15:46:42 +08:00
unionstore unionstore: replace pingcap/check with testify (#141) 2021-06-23 11:12:04 +08:00
util update license (#110) 2021-06-22 10:29:28 +08:00
.gitignore Ensure go.sum in track (#91) 2021-06-18 11:18:27 +08:00
.golangci.yml CI: add linter (#85) 2021-06-16 18:16:51 +08:00
CONTRIBUTING.md add contributing (#94) 2021-06-19 04:01:45 +08:00
LICENSE Initial commit 2018-12-01 12:03:35 +08:00
README.md branch name related changes (#146) 2021-06-23 12:07:37 +08:00
go.mod util: replace pingcap/check with testify (#103) 2021-06-21 23:53:10 +08:00
go.sum util: replace pingcap/check with testify (#103) 2021-06-21 23:53:10 +08:00

README.md

TiKV Go Client

TiKV Go Client provides support for interacting with the TiKV server in the form of a Go library.

Stability Active Go Reference

Unit Test Integration Test Compatibility Test

Package versions

There are 2 major versions of the client-go package.

  • v2 is the new stable and active version. This version was extracted from pingcap/tidb and it includes new TiKV features like Follower Read, 1PC, Async Commit. The development of this version is on the master branch. The documentation for this version is below.

  • v1 is the previous stable version and is only maintained for bug fixes. You can read the documentation here.

Usage/Examples

  go get github.com/tikv/client-go/v2@COMMIT_HASH_OR_TAG_VERSION

More examples can be found in examples directory.

Contributing to client-go

Pull Requests and issues are welcomed. Please check CONTRIBUTING.md.

Developing

Running Tests

Note: All the following tests are included in the CI and you can submit a Pull Request directly to hand over the work.

To run unit tests, use following command

go test -v ./...

To run code linter, make sure golangci-lint is installed. Then use following command

golangci-lint run

integration_tests can run against a real TiKV cluster. Here is an example:

./pd-server &
sleep 5
./tikv-server &
sleep 10
cd integration_tests
go test -v --with-tikv=true --pd-addrs=127.0.0.1:2379

Test with TiDB

It is a common task to update client-go and then test it with TiDB.

If you only need to test locally, you can directly use the modified client-go on the same host by replacing:

go mod edit -replace=github.com/tikv/client-go/v2=/path/to/client-go

If you want to push your TiDB code to GitHub for running CI or for code review, you need to change the client-go used by TiDB to your developing branch using the following steps:

go get -d github.com/GITHUB_USERNAME/client-go@DEV_BRANCH
# Output:
# go get: github.com/GITHUB_USERNAME/client-go/v2@none updating to
#         github.com/GITHUB_USERNAME/client-go/v2@v2.0.0-XXXXXXXXXXXXXX-XXXXXXXXXXXX: parsing go.mod:
#         module declares its path as: github.com/tikv/client-go/v2
#                 but was required as: github.com/GITHUB_USERNAME/client-go/v2
go mod edit -replace=github.com/tikv/client-go/v2=github.com/GITHUB_USERNAME/client-go/v2@v2.0.0-XXXXXXXXXXXXXX-XXXXXXXXXXXX
go mod download github.com/tikv/client-go/v2

Used By

client-go is used by the following projects:

License

Apache License 2.0