From c2d09a07e387a8b2d9bae55f31ae4ee35a84820c Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Sat, 1 Jul 2023 13:11:46 -0600 Subject: [PATCH] Fixed type resolution that was missed --- gql_graph.go | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/gql_graph.go b/gql_graph.go index a2e9f88..8ea403f 100644 --- a/gql_graph.go +++ b/gql_graph.go @@ -462,15 +462,11 @@ func GQLTypeBaseThread() * graphql.Object { return false } - thread_type, ok := p.Context.Value("thread_type").(*reflect.Type) - if ok == false { - ctx.Log.Logf("gql", "Failed to get thread_type from Context: %+v", p.Context.Value("thread_type")) - return false - } + thread_type := ctx.GQL.ThreadType value_type := reflect.TypeOf(p.Value) - if value_type.Implements(*thread_type) { + if value_type.Implements(thread_type) { return true } @@ -531,16 +527,10 @@ func GQLTypeBaseLockable() * graphql.Object { return false } - lockable_type, ok := p.Context.Value("lockable_type").(*reflect.Type) - if ok == false { - ctx.Log.Logf("gql", "Failed to get lockable_type from Context: %+v", p.Context.Value("lockable_type")) - return false - } - + lockable_type := ctx.GQL.LockableType value_type := reflect.TypeOf(p.Value) - ctx.Log.Logf("gql", "BASE_VALUE_TYPE: %+v", value_type) - if value_type.Implements(*lockable_type) { + if value_type.Implements(lockable_type) { return true } @@ -591,15 +581,10 @@ func GQLTypeBaseNode() * graphql.Object { return false } - node_type, ok := p.Context.Value("node_type").(*reflect.Type) - if ok == false { - ctx.Log.Logf("gql", "Failed to get node_type from Context: %+v", p.Context.Value("node_type")) - return false - } - + node_type := ctx.GQL.NodeType value_type := reflect.TypeOf(p.Value) - if value_type.Implements(*node_type) { + if value_type.Implements(node_type) { return true }