aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/vektah/gqlparser/ast/document.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/vektah/gqlparser/ast/document.go')
-rw-r--r--vendor/github.com/vektah/gqlparser/ast/document.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/vendor/github.com/vektah/gqlparser/ast/document.go b/vendor/github.com/vektah/gqlparser/ast/document.go
index b7657d62..4672d0c0 100644
--- a/vendor/github.com/vektah/gqlparser/ast/document.go
+++ b/vendor/github.com/vektah/gqlparser/ast/document.go
@@ -32,6 +32,7 @@ type Schema struct {
Directives map[string]*DirectiveDefinition
PossibleTypes map[string][]*Definition
+ Implements map[string][]*Definition
}
func (s *Schema) AddPossibleType(name string, def *Definition) {
@@ -40,17 +41,18 @@ func (s *Schema) AddPossibleType(name string, def *Definition) {
// GetPossibleTypes will enumerate all the definitions for a given interface or union
func (s *Schema) GetPossibleTypes(def *Definition) []*Definition {
- if def.Kind == Union {
- var defs []*Definition
- for _, t := range def.Types {
- defs = append(defs, s.Types[t])
- }
- return defs
- }
-
return s.PossibleTypes[def.Name]
}
+func (s *Schema) AddImplements(name string, iface *Definition) {
+ s.Implements[name] = append(s.Implements[name], iface)
+}
+
+// GetImplements returns all the interface and union definitions that the given definition satisfies
+func (s *Schema) GetImplements(def *Definition) []*Definition {
+ return s.Implements[def.Name]
+}
+
type SchemaDefinition struct {
Description string
Directives DirectiveList