From 76f43a27119e824c06908af44c232c40fc8cd6af Mon Sep 17 00:00:00 2001 From: marwan-at-work Date: Thu, 18 Jul 2019 14:02:53 -0400 Subject: [PATCH] Add ForNames method to DirectiveList --- ast/collections.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ast/collections.go b/ast/collections.go index 6bf67297..94b800ee 100644 --- a/ast/collections.go +++ b/ast/collections.go @@ -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 {