From 6949d6c543e9397578c7c840812df9bbf8531528 Mon Sep 17 00:00:00 2001 From: Amine Hilaly Date: Wed, 15 May 2019 15:04:57 +0200 Subject: Upgrade gqlgen version to v0.9.0 --- .../99designs/gqlgen/codegen/config/binder.go | 27 +++++----------------- 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'vendor/github.com/99designs/gqlgen/codegen/config/binder.go') diff --git a/vendor/github.com/99designs/gqlgen/codegen/config/binder.go b/vendor/github.com/99designs/gqlgen/codegen/config/binder.go index f3956387..cea904ad 100644 --- a/vendor/github.com/99designs/gqlgen/codegen/config/binder.go +++ b/vendor/github.com/99designs/gqlgen/codegen/config/binder.go @@ -238,25 +238,6 @@ func (t *TypeReference) IsScalar() bool { return t.Definition.Kind == ast.Scalar } -func (t *TypeReference) HasIsZero() bool { - it := t.GO - if ptr, isPtr := it.(*types.Pointer); isPtr { - it = ptr.Elem() - } - namedType, ok := it.(*types.Named) - if !ok { - return false - } - - for i := 0; i < namedType.NumMethods(); i++ { - switch namedType.Method(i).Name() { - case "IsZero": - return true - } - } - return false -} - func (t *TypeReference) UniquenessKey() string { var nullability = "O" if t.GQL.NonNull { @@ -368,7 +349,7 @@ func (b *Binder) TypeReference(schemaType *ast.Type, bindTarget types.Type) (ret } else if hasMethod(obj.Type(), "MarshalGQL") && hasMethod(obj.Type(), "UnmarshalGQL") { ref.GO = obj.Type() ref.IsMarshaler = true - } else if underlying := basicUnderlying(obj.Type()); underlying != nil && underlying.Kind() == types.String { + } else if underlying := basicUnderlying(obj.Type()); def.IsLeafType() && underlying != nil && underlying.Kind() == types.String { // Special case for named types wrapping strings. Used by default enum implementations. ref.GO = obj.Type() @@ -402,7 +383,11 @@ func (b *Binder) TypeReference(schemaType *ast.Type, bindTarget types.Type) (ret func (b *Binder) CopyModifiersFromAst(t *ast.Type, base types.Type) types.Type { if t.Elem != nil { - return types.NewSlice(b.CopyModifiersFromAst(t.Elem, base)) + child := b.CopyModifiersFromAst(t.Elem, base) + if _, isStruct := child.Underlying().(*types.Struct); isStruct { + child = types.NewPointer(child) + } + return types.NewSlice(child) } var isInterface bool -- cgit