Class: Rooq::WindowFrame

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/rooq/expression.rb

Overview

Window frame specification

Constant Summary collapse

FrameBound =
T.type_alias { T.any(Symbol, T::Array[T.any(Symbol, Integer)]) }
ROWS =
T.let(:rows, Symbol)
RANGE =
T.let(:range, Symbol)
GROUPS =
T.let(:groups, Symbol)
UNBOUNDED_PRECEDING =
T.let(:unbounded_preceding, Symbol)
CURRENT_ROW =
T.let(:current_row, Symbol)
UNBOUNDED_FOLLOWING =
T.let(:unbounded_following, Symbol)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, start_bound, end_bound = nil) ⇒ void

Parameters:



326
327
328
329
330
331
# File 'lib/rooq/expression.rb', line 326

def initialize(type, start_bound, end_bound = nil)
  @type = type
  @start_bound = start_bound
  @end_bound = end_bound
  freeze
end

Instance Attribute Details

#end_boundFrameBound? (readonly)

Returns:



315
316
317
# File 'lib/rooq/expression.rb', line 315

def end_bound
  @end_bound
end

#start_boundFrameBound (readonly)

Returns:



312
313
314
# File 'lib/rooq/expression.rb', line 312

def start_bound
  @start_bound
end

#typeSymbol (readonly)

Returns:

  • (Symbol)


309
310
311
# File 'lib/rooq/expression.rb', line 309

def type
  @type
end

Class Method Details

.following(n) ⇒ Array<Symbol, Integer>

Parameters:

  • n (Integer)

Returns:

  • (Array<Symbol, Integer>)


352
353
354
# File 'lib/rooq/expression.rb', line 352

def following(n)
  [:following, n]
end

.preceding(n) ⇒ Array<Symbol, Integer>

Parameters:

  • n (Integer)

Returns:

  • (Array<Symbol, Integer>)


347
348
349
# File 'lib/rooq/expression.rb', line 347

def preceding(n)
  [:preceding, n]
end

.range(start_bound, end_bound = nil) ⇒ WindowFrame

Parameters:

Returns:



342
343
344
# File 'lib/rooq/expression.rb', line 342

def range(start_bound, end_bound = nil)
  WindowFrame.new(RANGE, start_bound, end_bound)
end

.rows(start_bound, end_bound = nil) ⇒ WindowFrame

Parameters:

Returns:



337
338
339
# File 'lib/rooq/expression.rb', line 337

def rows(start_bound, end_bound = nil)
  WindowFrame.new(ROWS, start_bound, end_bound)
end