aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/99designs/gqlgen/codegen/object.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/99designs/gqlgen/codegen/object.go')
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/object.go33
1 files changed, 21 insertions, 12 deletions
diff --git a/vendor/github.com/99designs/gqlgen/codegen/object.go b/vendor/github.com/99designs/gqlgen/codegen/object.go
index d9f610f4..656af297 100644
--- a/vendor/github.com/99designs/gqlgen/codegen/object.go
+++ b/vendor/github.com/99designs/gqlgen/codegen/object.go
@@ -24,6 +24,7 @@ type Object struct {
Fields []Field
Satisfies []string
+ Implements []*NamedType
ResolverInterface *Ref
Root bool
DisableConcurrency bool
@@ -32,16 +33,17 @@ type Object struct {
type Field struct {
*Type
- Description string // Description of a field
- GQLName string // The name of the field in graphql
- GoFieldType GoFieldType // The field type in go, if any
- GoReceiverName string // The name of method & var receiver in go, if any
- GoFieldName string // The name of the method or var in go, if any
- Args []FieldArgument // A list of arguments to be passed to this field
- ForceResolver bool // Should be emit Resolver method
- NoErr bool // If this is bound to a go method, does that method have an error as the second argument
- Object *Object // A link back to the parent object
- Default interface{} // The default value
+ Description string // Description of a field
+ GQLName string // The name of the field in graphql
+ GoFieldType GoFieldType // The field type in go, if any
+ GoReceiverName string // The name of method & var receiver in go, if any
+ GoFieldName string // The name of the method or var in go, if any
+ Args []FieldArgument // A list of arguments to be passed to this field
+ ForceResolver bool // Should be emit Resolver method
+ MethodHasContext bool // If this is bound to a go method, does the method also take a context
+ NoErr bool // If this is bound to a go method, does that method have an error as the second argument
+ Object *Object // A link back to the parent object
+ Default interface{} // The default value
}
type FieldArgument struct {
@@ -102,7 +104,10 @@ func (f *Field) IsVariable() bool {
}
func (f *Field) IsConcurrent() bool {
- return f.IsResolver() && !f.Object.DisableConcurrency
+ if f.Object.DisableConcurrency {
+ return false
+ }
+ return f.MethodHasContext || f.IsResolver()
}
func (f *Field) GoNameExported() string {
@@ -203,11 +208,15 @@ func (f *Field) CallArgs() string {
var args []string
if f.IsResolver() {
- args = append(args, "ctx")
+ args = append(args, "rctx")
if !f.Object.Root {
args = append(args, "obj")
}
+ } else {
+ if f.MethodHasContext {
+ args = append(args, "ctx")
+ }
}
for _, arg := range f.Args {