Module: Rooq::WindowFunctions
- Extended by:
- T::Sig
- Defined in:
- lib/rooq/expression.rb
Overview
Window functions module
Class Method Summary collapse
- .dense_rank ⇒ WindowFunction
- .first_value(expression) ⇒ WindowFunction
- .lag(expression, offset = 1, default = nil) ⇒ WindowFunction
- .last_value(expression) ⇒ WindowFunction
- .lead(expression, offset = 1, default = nil) ⇒ WindowFunction
- .nth_value(expression, n) ⇒ WindowFunction
- .ntile(n) ⇒ WindowFunction
- .rank ⇒ WindowFunction
- .row_number ⇒ WindowFunction
Class Method Details
.dense_rank ⇒ WindowFunction
376 377 378 |
# File 'lib/rooq/expression.rb', line 376 def dense_rank WindowFunction.new(FunctionCall.new(:dense_rank)) end |
.first_value(expression) ⇒ WindowFunction
400 401 402 |
# File 'lib/rooq/expression.rb', line 400 def first_value(expression) WindowFunction.new(FunctionCall.new(:first_value, expression)) end |
.lag(expression, offset = 1, default = nil) ⇒ WindowFunction
386 387 388 389 390 |
# File 'lib/rooq/expression.rb', line 386 def lag(expression, offset = 1, default = nil) args = [expression, Literal.new(offset)] args << default if default WindowFunction.new(FunctionCall.new(:lag, *args)) end |
.last_value(expression) ⇒ WindowFunction
405 406 407 |
# File 'lib/rooq/expression.rb', line 405 def last_value(expression) WindowFunction.new(FunctionCall.new(:last_value, expression)) end |
.lead(expression, offset = 1, default = nil) ⇒ WindowFunction
393 394 395 396 397 |
# File 'lib/rooq/expression.rb', line 393 def lead(expression, offset = 1, default = nil) args = [expression, Literal.new(offset)] args << default if default WindowFunction.new(FunctionCall.new(:lead, *args)) end |
.nth_value(expression, n) ⇒ WindowFunction
410 411 412 |
# File 'lib/rooq/expression.rb', line 410 def nth_value(expression, n) WindowFunction.new(FunctionCall.new(:nth_value, expression, Literal.new(n))) end |
.ntile(n) ⇒ WindowFunction
381 382 383 |
# File 'lib/rooq/expression.rb', line 381 def ntile(n) WindowFunction.new(FunctionCall.new(:ntile, Literal.new(n))) end |
.rank ⇒ WindowFunction
371 372 373 |
# File 'lib/rooq/expression.rb', line 371 def rank WindowFunction.new(FunctionCall.new(:rank)) end |
.row_number ⇒ WindowFunction
366 367 368 |
# File 'lib/rooq/expression.rb', line 366 def row_number WindowFunction.new(FunctionCall.new(:row_number)) end |