gitdb is a simple git wrapper that lets you use git as a database.
Here's a simple program to get started:
package main
import (
"encoding/json""log""github.com/makramkd/gitdb"
)
funcmain() {
db:=gitdb.GetInstance()
err:=db.Open("./repo1")
iferr!=nil {
log.Fatalf("Could not open repo1: %s", err.Error())
}
s:=struct {
NamestringEmailstring
}{
Name: "makram kamaleddine",
Email: "makram.kd@github.com",
}
marshaled, err:=json.MarshalIndent(s, "", " ")
iferr!=nil {
log.Fatalf("Could not marshal struct: %s", err.Error())
}
err=db.Save(marshaled, "helloworld.json")
iferr!=nil {
log.Fatalf("Failed to save file to repo: %s", err.Error())
}
}gitdb is very much a dumb proof of concept and not ready for production use.