An open API service indexing awesome lists of open source software.

https://github.com/schollz/boltdb-server

Fancy server and Go package for connecting to BoltDB databases
https://github.com/schollz/boltdb-server

Last synced: 6 months ago
JSON representation

Fancy server and Go package for connecting to BoltDB databases

Awesome Lists containing this project

README

          


BoltDB Server


Build Status
Code Coverage
GoDoc

A fancy server for Bolt databases

*boltdb-server* is a server and package (`connect`) for remotely interfacing
with [boltdb/bolt](https://github.com/boltdb/bolt), a pure-Go embedded key/value database.

Features
========

- Automatic compression of values
- Simple API for getting, setting, moving, popping and deleting BoltDB data
- Package for adding to your Go programs

Getting Started
===============

## Installing

To start using the server, install Go and run `go get`:

```sh
$ go get -u github.com/schollz/boltdb-server/...
```

This will retrieve the library and the server.

## Run

Run the server using

```sh
$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](https://github.com/schollz/boltdb-server/blob/master/connect/connect_test.go).

## API

```
// Get map of buckets and the number of keys in each
GET /v1/db//stats

// Get list of all buckets
GET /v1/db//buckets

// Get all keys and values from a bucket
GET /v1/db//bucket//numkeys

// Get all keys and values from a bucket
GET /v1/db//bucket//all

// Get all keys and values specified by ?keys=key1,key2 or by JSON
GET /v1/db//bucket//some

// Delete and return first n keys
GET /v1/db//bucket//pop?n=X

// Get all keys in a bucket
GET /v1/db//bucket//keys", handleGetKeys)

// Return boolean of whether it has key
GET /v1/db//bucket//haskey/

// Return boolean of whether any buckets contain any keys specified by JSON
GET /v1/db//haskeys

// Delete database file
DELETE /v1/db/

// Delete bucket
DELETE /v1/db//bucket/

// Delete keys, where keys are specified by JSON []string
DELETE /v1/db//bucket//keys

// Updates a database with keystore specified by JSON
POST /v1/db//bucket//update

// Move keys, with buckets and keys specified by JSON
POST /v1/db//move

// Create buckets specified by JSON
POST /v1/db//create
```