Allow opening a database (bolt, leveldb, mongo) through Go API
This commit is contained in:
parent
c2e410dd2c
commit
3b58ae9994
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}
|
||||
}
|
||||
|
||||
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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue