代码拉取完成,页面将自动刷新
package cayley
import (
"github.com/cayleygraph/cayley/graph"
"github.com/cayleygraph/cayley/graph/iterator"
_ "github.com/cayleygraph/cayley/graph/memstore"
"github.com/cayleygraph/cayley/query/path"
_ "github.com/cayleygraph/cayley/writer"
"github.com/cayleygraph/quad"
)
var (
StartMorphism = path.StartMorphism
StartPath = path.StartPath
NewTransaction = graph.NewTransaction
)
type Iterator = iterator.Shape
type QuadStore = graph.QuadStore
type QuadWriter = graph.QuadWriter
type Path = path.Path
type Handle struct {
graph.QuadStore
graph.QuadWriter
}
func (h *Handle) Close() error {
err := h.QuadWriter.Close()
h.QuadStore.Close()
return err
}
func Triple(subject, predicate, object interface{}) quad.Quad {
return Quad(subject, predicate, object, nil)
}
func Quad(subject, predicate, object, label interface{}) quad.Quad {
return quad.Make(subject, predicate, object, label)
}
func NewGraph(name, dbpath string, opts graph.Options) (*Handle, error) {
qs, err := graph.NewQuadStore(name, dbpath, opts)
if err != nil {
return nil, err
}
qw, err := graph.NewQuadWriter("single", qs, nil)
if err != nil {
return nil, err
}
return &Handle{qs, qw}, nil
}
func NewMemoryGraph() (*Handle, error) {
return NewGraph("memstore", "", nil)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。