Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nanobox-io/golang-scribble
A tiny Golang JSON database
https://github.com/nanobox-io/golang-scribble
Last synced: about 2 months ago
JSON representation
A tiny Golang JSON database
- Host: GitHub
- URL: https://github.com/nanobox-io/golang-scribble
- Owner: nanobox-io
- License: mit
- Fork: true (sdomino/scribble)
- Created: 2018-06-21T22:13:33.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-09T22:57:36.000Z (almost 6 years ago)
- Last Synced: 2024-10-25T04:09:54.676Z (about 2 months ago)
- Language: Go
- Homepage:
- Size: 51.8 KB
- Stars: 174
- Watchers: 7
- Forks: 29
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go-storage - scribble - A tiny flat file JSON store. (Database)
- awesome-ccamel - nanobox-io/golang-scribble - A tiny Golang JSON database (Go)
- awesome-go - golang-scribble - A tiny Golang JSON database - ★ 16 (Database)
- awesome-go-storage - scribble - A tiny flat file JSON store. (Database)
README
Scribble [![GoDoc](https://godoc.org/github.com/boltdb/bolt?status.svg)](http://godoc.org/github.com/nanobox-io/golang-scribble) [![Go Report Card](https://goreportcard.com/badge/github.com/nanobox-io/golang-scribble)](https://goreportcard.com/report/github.com/nanobox-io/golang-scribble)
--------A tiny JSON database in Golang
### Installation
Install using `go get github.com/nanobox-io/golang-scribble`.
### Usage
```go
// a new scribble driver, providing the directory where it will be writing to,
// and a qualified logger if desired
db, err := scribble.New(dir, nil)
if err != nil {
fmt.Println("Error", err)
}// Write a fish to the database
fish := Fish{}
if err := db.Write("fish", "onefish", fish); err != nil {
fmt.Println("Error", err)
}// Read a fish from the database (passing fish by reference)
onefish := Fish{}
if err := db.Read("fish", "onefish", &onefish); err != nil {
fmt.Println("Error", err)
}// Read all fish from the database, unmarshaling the response.
records, err := db.ReadAll("fish")
if err != nil {
fmt.Println("Error", err)
}fishies := []Fish{}
for _, f := range records {
fishFound := Fish{}
if err := json.Unmarshal([]byte(f), &fishFound); err != nil {
fmt.Println("Error", err)
}
fishies = append(fishies, fishFound)
}// Delete a fish from the database
if err := db.Delete("fish", "onefish"); err != nil {
fmt.Println("Error", err)
}// Delete all fish from the database
if err := db.Delete("fish", ""); err != nil {
fmt.Println("Error", err)
}
```## Documentation
- Complete documentation is available on [godoc](http://godoc.org/github.com/nanobox-io/golang-scribble).
- Coverage Report is available on [gocover](https://gocover.io/github.com/nanobox-io/golang-scribble)## Todo/Doing
- Support for windows
- Better support for concurrency
- Better support for sub collections
- More methods to allow different types of reads/writes
- More tests (you can never have enough!)## Contributing
Contributions to scribble are welcome and encouraged. Scribble is a [Nanobox](https://nanobox.io) project and contributions should follow the [Nanobox Contribution Process & Guidelines](https://docs.nanobox.io/contributing/).