go-gdbm provides Go bindings for the GNU database manager. The go-gdbm project is licensed under the MIT license.
You can view the API documentation here.
Open a database:
db, err := gdbm.Open("my-stuff.db")
if err != nil {
panic(err)
}
defer db.Close()
Store some data:
db.Store([]byte("strawberry"), []byte("red"))
db.Store([]byte("banana"), []byte("yellow"))
To delete an entry, call Store with nil as the second parameter.
To retrieve data for a key:
value := db.Fetch([]byte("strawberry"))
if string(value) != "red" {
panic("oh no!")
}