Skip to content

Commit

Permalink
Add ForNames method to DirectiveList
Browse files Browse the repository at this point in the history
  • Loading branch information
marwan-at-work committed Jul 18, 2019
1 parent 7ceb135 commit 76f43a2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ast/collections.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ func (l DirectiveList) ForName(name string) *Directive {
return nil
}

func (l DirectiveList) ForNames(name string) []*Directive {
resp := []*Directive{}
for _, it := range l {
if it.Name == name {
resp = append(resp, it)
}
}
return resp
}

type OperationList []*OperationDefinition

func (l OperationList) ForName(name string) *OperationDefinition {
Expand Down

0 comments on commit 76f43a2

Please sign in to comment.