MCPcopy
hub / github.com/cayleygraph/cayley / Quad

Method Quad

graph/kv/quadstore.go:372–392  ·  view source on GitHub ↗
(k graph.Ref)

Source from the content-addressed store, hash-verified

370}
371
372func (qs *QuadStore) Quad(k graph.Ref) quad.Quad {
373 key, ok := k.(*proto.Primitive)
374 if !ok {
375 clog.Errorf("passed value was not a quad primitive: %T", k)
376 return quad.Quad{}
377 }
378 ctx := context.TODO()
379 var v quad.Quad
380 err := kv.View(qs.db, func(tx kv.Tx) error {
381 var err error
382 v, err = qs.primitiveToQuad(ctx, tx, key)
383 return err
384 })
385 if err != nil {
386 if err != kv.ErrNotFound {
387 clog.Errorf("error fetching quad %#v: %s", key, err)
388 }
389 return quad.Quad{}
390 }
391 return v
392}
393
394func (qs *QuadStore) primitiveToQuad(ctx context.Context, tx kv.Tx, p *proto.Primitive) (quad.Quad, error) {
395 q := &quad.Quad{}

Callers

nothing calls this directly

Implementers 1

QuadStoregraph/gaedatastore/quadstore.go

Calls 2

primitiveToQuadMethod · 0.95
ErrorfFunction · 0.92

Tested by

no test coverage detected