aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/99designs/gqlgen/codegen/config/binder.go
diff options
context:
space:
mode:
authorAmine Hilaly <hilalyamine@gmail.com>2019-05-15 15:04:57 +0200
committerAmine Hilaly <hilalyamine@gmail.com>2019-05-15 15:04:57 +0200
commit6949d6c543e9397578c7c840812df9bbf8531528 (patch)
treecdbc6c797b406029f03b5e5391fe1afdea88ce8e /vendor/github.com/99designs/gqlgen/codegen/config/binder.go
parent97476ff5fadaf0a457d0f0133db58415b6075940 (diff)
downloadgit-bug-6949d6c543e9397578c7c840812df9bbf8531528.tar.gz
Upgrade gqlgen version to v0.9.0
Diffstat (limited to 'vendor/github.com/99designs/gqlgen/codegen/config/binder.go')
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/config/binder.go27
1 files changed, 6 insertions, 21 deletions
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