diff options
Diffstat (limited to 'vendor/github.com/99designs/gqlgen/codegen/interface.go')
-rw-r--r-- | vendor/github.com/99designs/gqlgen/codegen/interface.go | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/vendor/github.com/99designs/gqlgen/codegen/interface.go b/vendor/github.com/99designs/gqlgen/codegen/interface.go deleted file mode 100644 index f59e8ed0..00000000 --- a/vendor/github.com/99designs/gqlgen/codegen/interface.go +++ /dev/null @@ -1,63 +0,0 @@ -package codegen - -import ( - "go/types" - - "github.com/vektah/gqlparser/ast" -) - -type Interface struct { - *ast.Definition - Type types.Type - Implementors []InterfaceImplementor - InTypemap bool -} - -type InterfaceImplementor struct { - *ast.Definition - - Interface *Interface - Type types.Type -} - -func (b *builder) buildInterface(typ *ast.Definition) *Interface { - obj, err := b.Binder.DefaultUserObject(typ.Name) - if err != nil { - panic(err) - } - - i := &Interface{ - Definition: typ, - Type: obj, - InTypemap: b.Config.Models.UserDefined(typ.Name), - } - - for _, implementor := range b.Schema.GetPossibleTypes(typ) { - obj, err := b.Binder.DefaultUserObject(implementor.Name) - if err != nil { - panic(err) - } - - i.Implementors = append(i.Implementors, InterfaceImplementor{ - Definition: implementor, - Type: obj, - Interface: i, - }) - } - - return i -} - -func (i *InterfaceImplementor) ValueReceiver() bool { - interfaceType, err := findGoInterface(i.Interface.Type) - if interfaceType == nil || err != nil { - return true - } - - implementorType, err := findGoNamedType(i.Type) - if implementorType == nil || err != nil { - return true - } - - return types.Implements(implementorType, interfaceType) -} |