IsReversed returns whether the predicate has reverse edge or not
(ctx context.Context, pred string)
| 434 | |
| 435 | // IsReversed returns whether the predicate has reverse edge or not |
| 436 | func (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. |
| 452 | func (s *state) HasCount(ctx context.Context, pred string) bool { |