diff options
author | Amine Hilaly <hilalyamine@gmail.com> | 2019-07-07 13:37:03 +0200 |
---|---|---|
committer | Amine Hilaly <hilalyamine@gmail.com> | 2019-07-07 13:37:03 +0200 |
commit | e381d5554a1b2b6e3a750206a853e090ec8183ab (patch) | |
tree | c4e19908c27389f9ccf030112efbf1f72e2469c5 /vendor/github.com/99designs/gqlgen/codegen/field.go | |
parent | cb7fefdc99cac1952c7a6f6765420819aee71d63 (diff) | |
download | git-bug-e381d5554a1b2b6e3a750206a853e090ec8183ab.tar.gz |
Update gqlgen vendors
Diffstat (limited to 'vendor/github.com/99designs/gqlgen/codegen/field.go')
-rw-r--r-- | vendor/github.com/99designs/gqlgen/codegen/field.go | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/vendor/github.com/99designs/gqlgen/codegen/field.go b/vendor/github.com/99designs/gqlgen/codegen/field.go index f5f7b221..264b59ce 100644 --- a/vendor/github.com/99designs/gqlgen/codegen/field.go +++ b/vendor/github.com/99designs/gqlgen/codegen/field.go @@ -284,7 +284,28 @@ func (b *builder) findBindStructTarget(strukt *types.Struct, name string) (types } func (f *Field) HasDirectives() bool { - return len(f.Directives) > 0 + return len(f.ImplDirectives()) > 0 +} + +func (f *Field) DirectiveObjName() string { + if f.Object.Root { + return "nil" + } + return f.GoReceiverName +} + +func (f *Field) ImplDirectives() []*Directive { + var d []*Directive + loc := ast.LocationFieldDefinition + if f.Object.IsInputType() { + loc = ast.LocationInputFieldDefinition + } + for i := range f.Directives { + if !f.Directives[i].Builtin && f.Directives[i].IsLocation(loc) { + d = append(d, f.Directives[i]) + } + } + return d } func (f *Field) IsReserved() bool { |