etcd-io /bbolt

An embedded key/value database for Go.

★ 9,832⑂ 777👁 115⑃ 972● 352▤ 25
GoMITCreated 2017-06-17go.etcd.io/bbolt
TA的项目
下载:v1.5.0v1.5.0 ↓1.5.02026-06-21
+2
日增长
9,832
stars
777
forks
115
watchers
972
prs
352
issues
25
releases

README

bbolt
=====






bbolt is a fork of [Ben Johnson's][gh_ben] [Bolt][bolt] key/value
store. The purpose of this fork is to provide the Go community with an active
maintenance and development target for Bolt; the goal is improved reliability
and stability. bbolt includes bug fixes, performance enhancements, and features
not found in Bolt while preserving backwards compatibility with the Bolt API.

Bolt is a pure Go key/value store inspired by [Howard Chu's][hyc_symas]
[LMDB project][lmdb]. The goal of the project is to provide a simple,
fast, and reliable database for projects that don't require a full database
server such as Postgres or MySQL.

Since Bolt is meant to be used as such a low-level piece of functionality,
simplicity is key. The API will be small and only focus on getting values
and setting values. That's it.

[gh_ben]: https://github.com/benbjohnson
[bolt]: https://github.com/boltdb/bolt
[hyc_symas]: https://twitter.com/hyc_symas
[lmdb]: https://www.symas.com/symas-embedded-database-lmdb

 Project Status

Bolt is stable, the API is fixed, and the file format is fixed. Full unit
test coverage and randomized black box testing are used to ensure database
consistency and thread safety. Bolt is currently used in high-load production
environments serving databases as large as 1TB. Many companies such as
Shopify and Heroku use Bolt-backed services every day.

 Project versioning

bbolt uses semantic versioning.
API should not change between patch and minor releases.
New minor versions may add additional features to the API.

 Table of Contents

  - Getting Started
    - Installing
    - Opening a database
    - Transactions
      - Read-write transactions
      - Read-only transactions
      - Batch read-write transactions
      - Managing transactions manually
    - Using buckets
    - Using key/value pairs
    - Autoincrementing integer for the bucket
    - Iterating over keys
      - Prefix scans
      - Range scans
      - ForEach()
    - Nested buckets
    - Database backups
    - Statistics
    - Read-Only Mode
    - Mobile Use (iOS/Android)
  - Resources
  - Comparison with other databases
    - Postgres, MySQL, & other relational databases
    - LevelDB, RocksDB
    - LMDB
  - Caveats & Limitations
  - Reading the Source
  - Known Issues
  - Other Projects Using Bolt

 Getting Started

 Installing

To start using bbolt, install Go and run go get:
sh
$ go get go.etcd.io/bbolt@latest


This will retrieve the library and update your go.mod and go.sum files.

To run the command line utility, execute:
sh
$ go run go.etcd.io/bbolt/cmd/bbolt@latest


Run go install to install the bbolt command line utility into
your $GOBIN path, which defaults to $GOPATH/bin or $HOME/go/bin if the
GOPATH environment variable is not set.
sh
$ go install go.etcd.io/bbolt/cmd/bbolt@latest


 Importing bbolt

To use bbolt as an embedded key-value store, import as:

go
import bolt "go.etcd.io/bbolt"

db, err := bolt.Open(path, 0600, nil)
if err != nil {
  return

Top issues

Discussions

Latest release

v1.5.0 v1.5.0 2026-06-21
See the CHANGELOG/v1.5.0 for more details.

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON