MelopeponDB
Install
go get github.com/benduckwdesign/melopepondb
Features
- Extendable — Easy to edit code and add custom backends
- Small database — Smaller than most database setups
- Simple — Easy to understand and use
- Standardized — Uses standard Go encoding packages as dependencies
- Tables — Supports tables, although entirely optional
- MIT license
Roadmap
These features are not guaranteed to be implemented, but they are certainly welcome.
- JSON backend
- Add check for conflicting database names
- Ability to toggle synchronous writes on or off independently
- Transaction Locking
- Split database map into subfiles so that InMem: false will read from disk
- Implement caching behavior for InMem false to keep the last X read values in memory
How to use?
Using MelopeponDB is simple. Here is a basic example for the Gob backend.
To use the JSON backend, simply call OpenJsonDB
instead.
Multiple backend types can be used at the same time within the same project.
Labels for databases must be unique.
Warning
Do not use the same labels for different databases with differing backends.
package main
import (
melo "github.com/benduckwdesign/melopepondb"
)
var pdb melo.DBFilter = melo.Query().DB("DatabaseOfPeople").Table("family")
type familyPerson struct {
Name string
Age *int
}
func main() {
defer melo.CloseDB("DatabaseOfPeople")
melo.OpenGobDB("DatabaseOfPeople", "people_db", false)
grandma := familyPerson{
Name: "Ruby",
Age: nil,
}
pdb.Update("grandma", &grandma)
var grandpa familyPerson
pdb.Get("grandma", &grandpa)
grandpa.Name = "Johnny"
pdb.Update("grandpa", &grandpa)
}
License
MelopeponDB is licensed under the MIT License.