Class: GraphQL::FancyLoader::RankQueryGenerator
- Inherits:
-
Object
- Object
- GraphQL::FancyLoader::RankQueryGenerator
- Defined in:
- lib/graphql/fancy_loader/rank_query_generator.rb
Instance Method Summary collapse
-
#arel ⇒ Object
Our actual window function.
-
#initialize(column:, partition_by:, table:, name_suffix: '_rank') ⇒ RankQueryGenerator
constructor
A new instance of RankQueryGenerator.
Constructor Details
#initialize(column:, partition_by:, table:, name_suffix: '_rank') ⇒ RankQueryGenerator
Returns a new instance of RankQueryGenerator.
9 10 11 12 13 14 |
# File 'lib/graphql/fancy_loader/rank_query_generator.rb', line 9 def initialize(column:, partition_by:, table:, name_suffix: '_rank') @column = column @partition_by = partition_by @table = table @name_suffix = name_suffix end |
Instance Method Details
#arel ⇒ Object
Our actual window function.
ROW_NUMBER() OVER (#{partition})
19 20 21 |
# File 'lib/graphql/fancy_loader/rank_query_generator.rb', line 19 def arel Arel::Nodes::NamedFunction.new('ROW_NUMBER', []).over(partition).as(name) end |