module GraphQL::Relay::TypeExtensions

Mixin for Relay-related methods in type objects (used by BaseType and Schema::Member).

Public Instance Methods

connection_type() click to toggle source

@return [GraphQL::ObjectType] The default connection type for this object type

# File lib/graphql/relay/type_extensions.rb, line 7
def connection_type
  @connection_type ||= define_connection
end
define_connection(**kwargs, &block) click to toggle source

Define a custom connection type for this object type @return [GraphQL::ObjectType]

# File lib/graphql/relay/type_extensions.rb, line 13
def define_connection(**kwargs, &block)
  GraphQL::Relay::ConnectionType.create_type(self, **kwargs, &block)
end
define_edge(**kwargs, &block) click to toggle source

Define a custom edge type for this object type @return [GraphQL::ObjectType]

# File lib/graphql/relay/type_extensions.rb, line 24
def define_edge(**kwargs, &block)
  GraphQL::Relay::EdgeType.create_type(self, **kwargs, &block)
end
edge_type() click to toggle source

@return [GraphQL::ObjectType] The default edge type for this object type

# File lib/graphql/relay/type_extensions.rb, line 18
def edge_type
  @edge_type ||= define_edge
end