Allow opening a database (bolt, leveldb, mongo) through Go API

This commit is contained in:
Quentin MACHU 2015-05-29 23:19:45 -04:00
parent c2e410dd2c
commit 3b58ae9994

View file

@ -28,8 +28,8 @@ func Quad(subject, predicate, object, label string) quad.Quad {
return quad.Quad{subject, predicate, object, label}
}
func NewMemoryGraph() (*Handle, error) {
qs, err := graph.NewQuadStore("memstore", "", nil)
func NewGraph(name, dbpath string, opts graph.Options) (*Handle, error) {
qs, err := graph.NewQuadStore(name, dbpath, opts)
if err != nil {
return nil, err
}
@ -40,6 +40,10 @@ func NewMemoryGraph() (*Handle, error) {
return &Handle{qs, qw}, nil
}
func NewMemoryGraph() (*Handle, error) {
return NewGraph("memstore", "", nil)
}
func (h *Handle) Close() {
h.QuadStore.Close()
h.QuadWriter.Close()