MCPcopy Index your code
hub / github.com/cockroachdb/cockroach-go

github.com/cockroachdb/cockroach-go @v2.4.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.4.3 ↗ · + Follow
254 symbols 785 edges 23 files 148 documented · 58% 14 cross-repo links updated 23d agov2.4.2 · 2025-09-04★ 16917 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

CockroachDB Go Helpers Go Reference

This project contains helpers for CockroachDB users writing in Go: - crdb and its subpackages provide wrapper functions for retrying transactions that fail due to serialization errors. It is intended for use within any Go application. See crdb/README.md for more details. - testserver provides functions for starting and connecting to a locally running instance of CockroachDB. It is intended for use in test code.

Prerequisites

The current release (v2) of this library requires Go modules.

You can import it in your code using:

import (
    "github.com/cockroachdb/cockroach-go/v2/crdb"
    "github.com/cockroachdb/cockroach-go/v2/testserver"
)

Extension points exported contracts — how you extend this code

Tx (Interface)
Tx abstracts the operations needed by ExecuteInTx so that different frameworks (e.g. go's sql package, pgx, gorm) can be [5 …
crdb/common.go
WriteSkewTest (Interface)
WriteSkewTest abstracts the operations that needs to be performed by a particular framework for the purposes of TestExec [5 …
crdb/testing_util.go
RetryPolicy (Interface)
RetryPolicy constructs a new instance of a RetryFunc for each transaction it is used with. Instances of RetryPolicy can [3 …
crdb/retry.go
TestServer (Interface)
TestServer is a helper to run a real cockroach node. [1 implementers]
testserver/testserver.go
ExecuteCtxFunc (FuncType)
ExecuteCtxFunc represents a function that takes a context and variadic arguments and returns an error. It's used with Ex
crdb/tx.go
Conn (Interface)
Conn abstracts pgx transactions creators: pgx.Conn and pgxpool.Pool.
crdb/crdbpgxv5/pgx.go
Conn (Interface)
Conn abstracts pgx transactions creators: pgx.Conn and pgxpool.Pool.
crdb/crdbpgx/pgx.go
RetryFunc (FuncType)
RetryFunc owns the state for a transaction retry operation. Usually, this is just the retry count. RetryFunc is not assu
crdb/retry.go

Core symbols most depended-on inside this repo

String
called by 32
testserver/testserver.go
Close
called by 31
testserver/testserver.go
NewDBForTest
called by 27
testserver/testserver.go
Exec
called by 24
crdb/common.go
NewTestServer
called by 14
testserver/testserver.go
PGURL
called by 12
testserver/testserver.go
StoreOnDiskOpt
called by 10
testserver/testserver.go
AddListenAddrPortOpt
called by 10
testserver/testserver.go

Shape

Method 113
Function 99
Struct 29
Interface 10
FuncType 3

Languages

Go100%

Modules by API surface

testserver/testserver.go73 symbols
testserver/testserver_test.go21 symbols
crdb/tx.go17 symbols
testserver/binaries.go14 symbols
crdb/error.go13 symbols
testserver/version/version.go12 symbols
crdb/retry.go12 symbols
crdb/tx_test.go9 symbols
crdb/testing_util.go9 symbols
crdb/crdbpgxv5/pgx.go8 symbols
crdb/crdbpgx/pgx.go8 symbols
crdb/crdbgorm/gorm_test.go8 symbols

For agents

$ claude mcp add cockroach-go \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page