Skip to content

Commit

Permalink
Convert index directive if to switch
Browse files Browse the repository at this point in the history
Switch will be extended shortly, andis nicer than lots of if-elses
  • Loading branch information
AndrewSisley committed Sep 13, 2024
1 parent acecb6c commit 49ddc49
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/request/graphql/schema/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,15 @@ func collectionFromAstDefinition(
})

for _, directive := range def.Directives {
if directive.Name.Value == types.IndexDirectiveLabel {
switch directive.Name.Value {
case types.IndexDirectiveLabel:
index, err := indexFromAST(directive)
if err != nil {
return client.CollectionDefinition{}, err
}
indexDescriptions = append(indexDescriptions, index)
}
if directive.Name.Value == types.PolicySchemaDirectiveLabel {

case types.PolicySchemaDirectiveLabel:
policy, err := policyFromAST(directive)
if err != nil {
return client.CollectionDefinition{}, err
Expand Down

0 comments on commit 49ddc49

Please sign in to comment.