A fancy server for Bolt databases
boltdb-server is a server and package (connect
) for remotely interfacing
with boltdb/bolt, a pure-Go embedded key/value database.
- Automatic compression of values
- Simple API for getting, setting, moving, popping and deleting BoltDB data
- Package for adding to your Go programs
To start using the server, install Go and run go get
:
$ go get -u github.com/schollz/boltdb-server/...
This will retrieve the library and the server.
Run the server using
$GOPATH/bin/boltdb-server
Then you can use the server directly (see API below) or plug in a Go program using the connect package, see tests for more info.
// Get map of buckets and the number of keys in each
GET /v1/db/<db>/stats
// Get list of all buckets
GET /v1/db/<db>/buckets
// Get all keys and values from a bucket
GET /v1/db/<db>/bucket/<bucket>/numkeys
// Get all keys and values from a bucket
GET /v1/db/<db>/bucket/<bucket>/all
// Get all keys and values specified by ?keys=key1,key2 or by JSON
GET /v1/db/<db>/bucket/<bucket>/some
// Delete and return first n keys
GET /v1/db/<db>/bucket/<bucket>/pop?n=X
// Get all keys in a bucket
GET /v1/db/<db>/bucket/<bucket>/keys", handleGetKeys)
// Return boolean of whether it has key
GET /v1/db/<db>/bucket/<bucket>/haskey/<key>
// Return boolean of whether any buckets contain any keys specified by JSON
GET /v1/db/<db>/haskeys
// Delete database file
DELETE /v1/db/<db>
// Delete bucket
DELETE /v1/db/<db>/bucket/<bucket>
// Delete keys, where keys are specified by JSON []string
DELETE /v1/db/<db>/bucket/<bucket>/keys
// Updates a database with keystore specified by JSON
POST /v1/db/<db>/bucket/<bucket>/update
// Move keys, with buckets and keys specified by JSON
POST /v1/db/<db>/move
// Create buckets specified by JSON
POST /v1/db/<db>/create