GraphQL::SmartSelect
Plugin for graphql-ruby which helps to select only the required fields from the database.
Requirements
Ruby >= 2.3.0
graphql-ruby ~> 1.8.7
activerecord >= 4.2
Installation
Add this line to your application's Gemfile:
gem 'graphql-smart_select'
The Problem
Consider the following query:
query {
posts {
id
****** le
}
}
Ruby interface for serving this query:
module GraphqlAPI
module Types
class Query < GraphQL::Schema::Object
field :posts, Types::Post, null: false
def posts
Post.all
end
end
Plugin for graphql-ruby which helps to select only the required fields from the database.
Requirements
Ruby >= 2.3.0
graphql-ruby ~> 1.8.7
activerecord >= 4.2
Installation
Add this line to your application's Gemfile:
gem 'graphql-smart_select'
The Problem
Consider the following query:
query {
posts {
id
****** le
}
}
Ruby interface for serving this query:
module GraphqlAPI
module Types
class Query < GraphQL::Schema::Object
field :posts, Types::Post, null: false
def posts
Post.all
end
end
1 д. назад