MCPcopy
hub / github.com/dgraph-io/dgraph / IsReversed

Method IsReversed

schema/schema.go:436–449  ·  view source on GitHub ↗

IsReversed returns whether the predicate has reverse edge or not

(ctx context.Context, pred string)

Source from the content-addressed store, hash-verified

434
435// IsReversed returns whether the predicate has reverse edge or not
436func (s *state) IsReversed(ctx context.Context, pred string) bool {
437 isWrite, _ := ctx.Value(IsWrite).(bool)
438 s.RLock()
439 defer s.RUnlock()
440 if isWrite {
441 if schema, ok := s.mutSchema[pred]; ok && schema.Directive == pb.SchemaUpdate_REVERSE {
442 return true
443 }
444 }
445 if schema, ok := s.predicate[pred]; ok {
446 return schema.Directive == pb.SchemaUpdate_REVERSE
447 }
448 return false
449}
450
451// HasCount returns whether we want to mantain a count index for the given predicate or not.
452func (s *state) HasCount(ctx context.Context, pred string) bool {

Callers 4

helpProcessTaskMethod · 0.80
handleDeleteAllMethod · 0.80
AddMutationWithIndexMethod · 0.80
TestSchemaIndexCustomFunction · 0.80

Calls 3

RLockMethod · 0.80
RUnlockMethod · 0.80
ValueMethod · 0.45

Tested by 1

TestSchemaIndexCustomFunction · 0.64