Class: Ecoportal::API::GraphQL::Logic::QueryConnection
- Inherits:
-
Logic::Query
- Object
- Logic::Query
- Ecoportal::API::GraphQL::Logic::QueryConnection
show all
- Includes:
- Enumerable
- Defined in:
- lib/ecoportal/api/graphql/logic/query_connection.rb
Instance Method Summary
collapse
Instance Method Details
#each(connection_block: nil, **kargs, &block) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/ecoportal/api/graphql/logic/query_connection.rb', line 9
def each(connection_block: nil, **kargs, &block)
return to_enum(:each, **kargs, connection_block: connection_block) unless block
connection_block ||= default_connection_block
cursor = nil
loop do
kargs.update(after: cursor) if cursor
connection = query(**kargs, &connection_block)
page_info = connection.pageInfo
connection.nodes.each(&block)
break unless (cursor = page_info.endCursor)
end
end
|
#response_class ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/ecoportal/api/graphql/logic/query_connection.rb', line 27
def response_class
return connection_class if respond_to?(:connection_class)
@response_class ||= self.class.new_class(
item_class,
inherits: Logic::Connection,
namespace: "Ecoportal::API::GraphQL::Connection"
) do |klass|
klass.item_class = item_class
end
end
|