Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 713 Bytes

README.md

File metadata and controls

38 lines (28 loc) · 713 Bytes

go-gdbm

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.

Basic Usage

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!")
}