Skip to content

sean9999/harebrain

Repository files navigation

Harebrain

Harebrain is a simple file-backed db with the following characteristics:

  • every record is a file
  • every record must know how to marshal and unmarshal itself
  • every record has a Hash() function that produces a unique hash, which becomes the filename.

Getting started

import (
    "github.com/sean9999/harebrain"
)

type cat struct {
	Id    int
	Name  string
	Breed string
}

//  if you don't need a bespoke Hash() function, you can use [JsonRecord]
type catRecord = harebrain.JsonRecord[cat]

func main(){

    myCat := &cat{1,"Muffin","Calico"}
    db := harebrain.NewDatabase()
    db.Open("data")
    db.Table("cats").Insert(myCat)

}

About

harebrain is a very simple file-backed database

Resources

License

Stars

Watchers

Forks

Packages

No packages published