Merge pull request #268 from Quentin-M/openGoApi
Allow opening a database (bolt, leveldb, mongo) through Go API
This commit is contained in:
commit
34de880945
1 changed files with 6 additions and 2 deletions
|
|
@ -28,8 +28,8 @@ func Quad(subject, predicate, object, label string) quad.Quad {
|
||||||
return quad.Quad{subject, predicate, object, label}
|
return quad.Quad{subject, predicate, object, label}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMemoryGraph() (*Handle, error) {
|
func NewGraph(name, dbpath string, opts graph.Options) (*Handle, error) {
|
||||||
qs, err := graph.NewQuadStore("memstore", "", nil)
|
qs, err := graph.NewQuadStore(name, dbpath, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -40,6 +40,10 @@ func NewMemoryGraph() (*Handle, error) {
|
||||||
return &Handle{qs, qw}, nil
|
return &Handle{qs, qw}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewMemoryGraph() (*Handle, error) {
|
||||||
|
return NewGraph("memstore", "", nil)
|
||||||
|
}
|
||||||
|
|
||||||
func (h *Handle) Close() {
|
func (h *Handle) Close() {
|
||||||
h.QuadStore.Close()
|
h.QuadStore.Close()
|
||||||
h.QuadWriter.Close()
|
h.QuadWriter.Close()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue