Skip to content

Commit

Permalink
Merge pull request #2215 from josephschorr/check-readns
Browse files Browse the repository at this point in the history
Switch namespace read call in Check to simplify
  • Loading branch information
josephschorr authored Jan 29, 2025
2 parents 7466dea + 7c6022b commit 5a24d23
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions internal/graph/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,17 +682,13 @@ type Traits struct {
// types of the given relation support caveats or expiration.
func TraitsForArrowRelation(ctx context.Context, reader datastore.Reader, namespaceName string, relationName string) (Traits, error) {
// TODO(jschorr): Change to use the type system once we wire it through Check dispatch.
nsDefs, err := reader.LookupNamespacesWithNames(ctx, []string{namespaceName})
nsDef, _, err := reader.ReadNamespaceByName(ctx, namespaceName)
if err != nil {
return Traits{}, err
}

if len(nsDefs) != 1 {
return Traits{}, fmt.Errorf("namespace %q not found", namespaceName)
}

var relation *core.Relation
for _, rel := range nsDefs[0].Definition.Relation {
for _, rel := range nsDef.Relation {
if rel.Name == relationName {
relation = rel
break
Expand Down

0 comments on commit 5a24d23

Please sign in to comment.