Class: Rooq::DSL::OrderedSetOperation

Inherits:
Object
  • Object
show all
Defined in:
lib/rooq/dsl/select_query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(set_operation, order_specs, limit_value: nil, offset_value: nil) ⇒ OrderedSetOperation

Returns a new instance of OrderedSetOperation.



252
253
254
255
256
257
258
# File 'lib/rooq/dsl/select_query.rb', line 252

def initialize(set_operation, order_specs, limit_value: nil, offset_value: nil)
  @set_operation = set_operation
  @order_specs = order_specs.freeze
  @limit_value = limit_value
  @offset_value = offset_value
  freeze
end

Instance Attribute Details

#limit_valueObject (readonly)

Returns the value of attribute limit_value.



250
251
252
# File 'lib/rooq/dsl/select_query.rb', line 250

def limit_value
  @limit_value
end

#offset_valueObject (readonly)

Returns the value of attribute offset_value.



250
251
252
# File 'lib/rooq/dsl/select_query.rb', line 250

def offset_value
  @offset_value
end

#order_specsObject (readonly)

Returns the value of attribute order_specs.



250
251
252
# File 'lib/rooq/dsl/select_query.rb', line 250

def order_specs
  @order_specs
end

#set_operationObject (readonly)

Returns the value of attribute set_operation.



250
251
252
# File 'lib/rooq/dsl/select_query.rb', line 250

def set_operation
  @set_operation
end

Instance Method Details

#limit(value) ⇒ Object



260
261
262
# File 'lib/rooq/dsl/select_query.rb', line 260

def limit(value)
  OrderedSetOperation.new(@set_operation, @order_specs, limit_value: value, offset_value: @offset_value)
end

#offset(value) ⇒ Object



264
265
266
# File 'lib/rooq/dsl/select_query.rb', line 264

def offset(value)
  OrderedSetOperation.new(@set_operation, @order_specs, limit_value: @limit_value, offset_value: value)
end

#to_sql(dialect = Rooq::Dialect::PostgreSQL.new) ⇒ Object



268
269
270
# File 'lib/rooq/dsl/select_query.rb', line 268

def to_sql(dialect = Rooq::Dialect::PostgreSQL.new)
  dialect.render_ordered_set_operation(self)
end