Module: Dry::GraphQL::ROM
- Defined in:
- lib/dry/graphql/rom.rb
Overview
Adds graphql_type to a rom relation
require ‘dry/graphql/rom’
class Users < ROM::Relation
extend Dry::GraphQL::ROM
end
Instance Method Summary collapse
Instance Method Details
#graphql_type(opts = {}) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/dry/graphql/rom.rb', line 15 def graphql_type(opts = {}) return @graphql_type if @graphql_type base_schema = schema.any?(&:read?) ? schema.to_output_hash : NOOP_OUTPUT_SCHEMA type_name = Dry::Core::Inflector.singularize(name) @graphql_type ||= Dry::GraphQL.from(base_schema, name: type_name, **opts) end |