fbdb
fbdb is a file-based database. It is basically a SQL database that has file-like columns (Name, Date, Data) etc. It has some benefit to using a real filesystem for some instances, in that you can store millions of files without problems and you can also add compression.
Install
$ go get -v github.com/schollz/fbdb
Usage
You can insert data as "files":
fs, _ := fbdb.Open("new.db")
defer fs.Close()
f, _ := fs.NewFile("filename", []byte("data"))
fs.Save(f)You can can retrieve files by name:
f, _ := fs.Get("filename")You can use a callback to retrieve a selection of files:
fs.GetAll(func(f fbdb.File) bool {
fmt.Println(f)
if f.Name == "?" {
return true // will stop getting
}
return false // will continue getting next file
}, "SELECT * FROM fs")See examples for more information.
Contributing
Pull requests are welcome. Feel free to...
- Revise documentation
- Add new features
- Fix bugs
- Suggest improvements
Thanks
Thanks Dr. H for the idea.
License
MIT