Module: GraphQL::Relay::ConnectionType
- Defined in:
- lib/graphql/relay/connection_type.rb
Class Attribute Summary collapse
-
.default_nodes_field ⇒ Object
Returns the value of attribute default_nodes_field.
Class Method Summary collapse
-
.create_type(wrapped_type, edge_type: wrapped_type.edge_type, edge_class: GraphQL::Relay::Edge, nodes_field: ConnectionType.default_nodes_field, &block) ⇒ Object
Create a connection which exposes edges of this type.
Class Attribute Details
.default_nodes_field ⇒ Object
Returns the value of attribute default_nodes_field.
6 7 8 |
# File 'lib/graphql/relay/connection_type.rb', line 6 def default_nodes_field @default_nodes_field end |
Class Method Details
.create_type(wrapped_type, edge_type: wrapped_type.edge_type, edge_class: GraphQL::Relay::Edge, nodes_field: ConnectionType.default_nodes_field, &block) ⇒ Object
Create a connection which exposes edges of this type
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/graphql/relay/connection_type.rb', line 12 def self.create_type(wrapped_type, edge_type: wrapped_type.edge_type, edge_class: GraphQL::Relay::Edge, nodes_field: ConnectionType.default_nodes_field, &block) custom_edge_class = edge_class # Any call that would trigger `wrapped_type.ensure_defined` # must be inside this lazy block, otherwise we get weird # cyclical dependency errors :S ObjectType.define do name("#{wrapped_type.name}Connection") description("The connection type for #{wrapped_type.name}.") field :edges, types[edge_type], "A list of edges.", edge_class: custom_edge_class, property: :edge_nodes if nodes_field field :nodes, types[wrapped_type], "A list of nodes.", property: :edge_nodes end field :pageInfo, !PageInfo, "Information to aid in pagination.", property: :page_info block && instance_eval(&block) end end |