Pure-Go FDB client
Key-value transactions with reads, writes, range reads, and retries on retryable errors. The API is modeled on Apple's Go binding.
pkg/fdbgo/fdb Independent open source · Apache-2.0
A pure-Go FoundationDB client, a Go port of Apple's Record Layer, and an embedded SQL engine.
The client does not require cgo or libfdb_c. The SQL engine runs in the application process, so FoundationDB is the only server to operate.
Each layer is usable as an API. The Record Layer and SQL engine can also run on Apple's C client with the libfdbc build tag and cgo.
Key-value transactions with reads, writes, range reads, and retries on retryable errors. The API is modeled on Apple's Go binding.
pkg/fdbgo/fdb A Go port of Apple's Record Layer. Stores protobuf records with secondary indexes, schema metadata, and resumable scans.
pkg/recordlayer A database/sql driver over the Record Layer. Queries are planned and executed in the application process. It is not a PostgreSQL-compatible server.
pkg/relational/sqldriver Transact runs the function in a transaction and runs it again after a retryable error. Keep external side effects outside the function.
The repository includes complete Record Layer and SQL programs with setup and error handling.
value, err := db.Transact(
func(tx fdb.WritableTransaction) (any, error) {
tx.Set(fdb.Key("greeting"), []byte("hello"))
return tx.Get(fdb.Key("greeting")).Get()
},
)
if err != nil {
return err
}
fmt.Println(string(value.([]byte)))rows, err := sqlDB.QueryContext(ctx,
`SELECT id, email FROM users
WHERE status = ? ORDER BY id LIMIT 10`,
"active",
)
if err != nil {
return err
}
defer rows.Close()Each suite compares specific cases with an external reference implementation. A passing suite does not establish compatibility outside the tested cases.
Differential tests run the Go client and libfdb_c against the same FoundationDB cluster and compare the results.
Conformance tests exercise Go and Java reads and writes on shared stores. The Java reference is Record Layer 4.14.2.0.
Java conformance suiteCross-engine scenarios and regression tests compare query behavior with the Java relational layer.
SQL conformance scenariosCollation, TEXT Unicode behavior, Go-only vector layouts, and engine-private SQL continuation tokens have documented exceptions. Existing Go SQL storage may require an explicit migration.
Earlier Go-vs-libfdb_c speedup and write-parity claims were withdrawn. Benchmark results apply only to the measured configurations. Benchmarks → · Correction and methodology →
An unofficial, independent project. Not affiliated with, sponsored by, or endorsed by Apple Inc. or the FoundationDB project.