Sha256: 78bc81e8b5dc92e291425f909ae464bb5111ae827db15c7f47278190de17e357
Contents?: true
Size: 737 Bytes
Versions: 2
Compression:
Stored size: 737 Bytes
Contents
module GraphQL module Relay # The best way to make these is with the connection helper, # @see {GraphQL::DefinitionHelpers::DefinedByConfig::DefinitionConfig} class ConnectionField def self.create(underlying_field) field = GraphQL::Field.define do argument :first, types.Int argument :after, types.String argument :last, types.Int argument :before, types.String argument :order, types.String type(-> { underlying_field.type }) resolve -> (obj, args, ctx) { items = underlying_field.resolve(obj, args, ctx) underlying_field.type.connection_class.new(items, args) } end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
graphql-relay-0.2.0 | lib/graphql/relay/connection_field.rb |
graphql-relay-0.1.0 | lib/graphql/relay/connection_field.rb |