aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/99designs/gqlgen/codegen/config
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
parent97476ff5fadaf0a457d0f0133db58415b6075940 (diff)
downloadgit-bug-6949d6c543e9397578c7c840812df9bbf8531528.tar.gz
Upgrade gqlgen version to v0.9.0
Diffstat (limited to 'vendor/github.com/99designs/gqlgen/codegen/config')
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/config/binder.go27
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/config/config.go8
2 files changed, 11 insertions, 24 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
diff --git a/vendor/github.com/99designs/gqlgen/codegen/config/config.go b/vendor/github.com/99designs/gqlgen/codegen/config/config.go
index 0c72420e..1725adab 100644
--- a/vendor/github.com/99designs/gqlgen/codegen/config/config.go
+++ b/vendor/github.com/99designs/gqlgen/codegen/config/config.go
@@ -136,7 +136,7 @@ func (c *PackageConfig) normalize() error {
// If Package is not set, first attempt to load the package at the output dir. If that fails
// fallback to just the base dir name of the output filename.
if c.Package == "" {
- c.Package = code.NameForPackage(c.ImportPath())
+ c.Package = code.NameForDir(c.Dir())
}
return nil
@@ -363,8 +363,10 @@ func (c *Config) InjectBuiltins(s *ast.Schema) {
// These are additional types that are injected if defined in the schema as scalars.
extraBuiltins := TypeMap{
- "Time": {Model: StringList{"github.com/99designs/gqlgen/graphql.Time"}},
- "Map": {Model: StringList{"github.com/99designs/gqlgen/graphql.Map"}},
+ "Time": {Model: StringList{"github.com/99designs/gqlgen/graphql.Time"}},
+ "Map": {Model: StringList{"github.com/99designs/gqlgen/graphql.Map"}},
+ "Upload": {Model: StringList{"github.com/99designs/gqlgen/graphql.Upload"}},
+ "Any": {Model: StringList{"github.com/99designs/gqlgen/graphql.Any"}},
}
for typeName, entry := range extraBuiltins {