Class: GraphQL::FancyLoader::QueryGenerator
- Inherits:
-
Object
- Object
- GraphQL::FancyLoader::QueryGenerator
- Defined in:
- lib/graphql/fancy_loader/query_generator.rb
Instance Method Summary collapse
-
#initialize(model:, find_by:, sort:, keys:, before: nil, after: 0, first: nil, last: nil, where: nil, context: {}, modify_query: nil) ⇒ QueryGenerator
constructor
A new instance of QueryGenerator.
- #query ⇒ Object
Constructor Details
#initialize(model:, find_by:, sort:, keys:, before: nil, after: 0, first: nil, last: nil, where: nil, context: {}, modify_query: nil) ⇒ QueryGenerator
Returns a new instance of QueryGenerator.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/graphql/fancy_loader/query_generator.rb', line 17 def initialize( model:, find_by:, sort:, keys:, before: nil, after: 0, first: nil, last: nil, where: nil, context: {}, modify_query: nil ) @model = model @find_by = find_by @sort = sort @keys = keys @before = before @after = after @first = first @last = last @where = where @context = context @modify_query = modify_query end |
Instance Method Details
#query ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/graphql/fancy_loader/query_generator.rb', line 35 def query # Finally, go *back* to the ActiveRecord model, and do the final select @model.unscoped .select(Arel.star) .from(subquery) .where(pagination_filter(subquery)) .order(subquery[:row_number].asc) end |