goydb, a couchdb compatible embeddable database written in go
mkdir data
docker run -e GOYDB_ADMINS=admin:test -v data:/usr/local/var/goydb -p 7070:7070 goydb/goydb:latest
go get github.com/goydb/goydb/cmd/goydb
mkdir public
mkdir dbs
goydb
mkdir public
mkdir dbs
go run ./cmd/goydb
package main
import (
"log"
"net/http"
"github.com/goydb/goydb/pkg/goydb"
)
func main() {
// create new database default config
cfg, err := goydb.NewConfig()
if err != nil {
log.Fatal(err)
}
// create new database
gdb, err := cfg.BuildDatabase()
if err != nil {
log.Fatal(err)
}
// expose http api
err = http.ListenAndServe(cfg.ListenAddress, gdb.Handler)
if err != nil {
log.Fatal(err)
}
}
Add fauxton container to the router.
import (
"github.com/goydb/goydb/pkg/public"
"github.com/goydb/utils"
)
...
cfg.Containers = []public.Container{
utils.Fauxton{},
}
...
No.
See another example at the cmd/goydb/main.go
.
First, couchdb is awesome. This implementation is not aiming to replace couchdb. It just another part of the ecosystem, similar to PouchDB.
The aim is to be able to build golang apps with integrated couchdb technology. That means similar to pouchdb, integrate deeply with golang but enable sync to couchdb.
Couchdb has the right principles at its heart:
- REST
- HTTP
- Map Reduce
- JSON
- Replication
- Attachments
- Mango
Things that are differert from couchdb:
- Performance due to direct access to the database using golang apis (WIP)
- Attachment not part of the document storage but saved as regular files on disk next to the documents (WIP)
- Search is part of the main storage using https://github.com/blevesearch/bleve (WIP)
Things that I want to experiment with:
- Validation / Schema
- Allow json schema based validation
- HTTP
- Automatic OpenAPI specification
- GraphQL support
- Allow PATCH
- Allow mango for update of documents
- HTTP API for queues e.g.
/{db}/_queue/{msg}
- http vhost and proxies (https://github.com/goydb/vhost)
- Rendering via
- go templates
- jq
- Formats allow direct support for
- yaml
- bson
- Backup
- PIT backup
- dump/restore via http
- PIT backup
- Instrumentation first class metrics support
- Security
- add document based security (see apache/couchdb#1524)
- full jwt and oauth2 support