MCPcopy Index your code
hub / github.com/bobintornado/boltdb-boilerplate

github.com/bobintornado/boltdb-boilerplate @0.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.1 ↗ · + Follow
16 symbols 40 edges 2 files 8 documented · 50%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Go Report Card

boltdb-boilerplate

boltdb-boilerplate is a simple & stupid boilerplate project wrapping around boltdb, and aim to make simple calls as one-liners.

Methods Summary

  • InitBolt: Init the database
  • Close: Close the database
  • Get: Retrieve a value by key
  • Put: Put a key/value pair into a bucket
  • Delete: Delete a key/value pair from a bucket
  • GetAllKeys: Get all keys from a bucket in [][]byte fromat
  • GetAllKeyValues: Get all key/value pairs from a bucket in []BoltPair fromat

Usage Demo

// import
import "github.com/bobintornado/boltdb-boilerplate"

// Init
buckets := []string{"ownerBucket", "sensors"}

err := boltdbboilerplate.InitBolt("./database.boltdb", buckets)
if err != nil {
  log.Fatal("Can't init boltDB")
}

// Put
err = boltdbboilerplate.Put([]byte("ownerBucket"), []byte("ownerKey"), []byte("username"))

// Get owner 
value := boltdbboilerplate.Get([]byte("ownerBucket"), []byte("ownerKey"))

// Delete
err = boltdbboilerplate.Delete([]byte("ownerBucket"), []byte("ownerKey"))

// Insert two key/value
err = boltdbboilerplate.Put([]byte("sensors"), []byte("key1"), []byte("value1"))
err = boltdbboilerplate.Put([]byte("sensors"), []byte("key2"), []byte("value2"))

// Get all keys
keys := boltdbboilerplate.GetAllKeys([]byte("sensors"))
// keys = [key1, key2]

// Get all key/value pairs
pairs := boltdbboilerplate.GetAllKeyValues([]byte("sensors"))
// pairs = [{Key:key1, Value:value1}, {Key: key2, Value:value2}]

// Close
boltdbboilerplate.Close()

Docs

GoDoc

Core symbols most depended-on inside this repo

Put
called by 6
boilerplate.go
Get
called by 3
boilerplate.go
InitBolt
called by 1
boilerplate.go
Delete
called by 1
boilerplate.go
GetAllKeys
called by 1
boilerplate.go
GetAllKeyValues
called by 1
boilerplate.go
Close
called by 0
boilerplate.go

Shape

Function 15
Struct 1

Languages

Go100%

Modules by API surface

boilerplate_test.go8 symbols
boilerplate.go8 symbols

For agents

$ claude mcp add boltdb-boilerplate \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page