Module: GraphQL::Compatibility::LazyExecutionSpecification::LazySchema
- Defined in:
- lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb
Defined Under Namespace
Modules: LazyInstrumentation Classes: LazyPush, LazyPushCollection
Class Method Summary collapse
Class Method Details
.build(execution_strategy) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb', line 69 def self.build(execution_strategy) lazy_push_type = GraphQL::ObjectType.define do name "LazyPush" field :value, !types.Int field :push, !lazy_push_type do argument :value, types.Int resolve ->(o, a, c) { LazyPush.new(c, a[:value]) } end end query_type = GraphQL::ObjectType.define do name "Query" field :push, !lazy_push_type do argument :value, types.Int resolve ->(o, a, c) { LazyPush.new(c, a[:value]) } end connection :pushes, lazy_push_type.connection_type do argument :values, types[types.Int] resolve ->(o, a, c) { LazyPushCollection.new(c, a[:values]) } end end GraphQL::Schema.define do query(query_type) mutation(query_type) query_execution_strategy(execution_strategy) mutation_execution_strategy(execution_strategy) lazy_resolve(LazyPush, :push) lazy_resolve(LazyPushCollection, :push) instrument(:field, LazyInstrumentation) end end |