Class: Rooq::DSL::SetOperation

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operator, left, right, all: false) ⇒ SetOperation

Returns a new instance of SetOperation.



219
220
221
222
223
224
225
# File 'lib/rooq/dsl/select_query.rb', line 219

def initialize(operator, left, right, all: false)
  @operator = operator
  @left = left
  @right = right
  @all = all
  freeze
end

Instance Attribute Details

#allObject (readonly)

Returns the value of attribute all.



217
218
219
# File 'lib/rooq/dsl/select_query.rb', line 217

def all
  @all
end

#leftObject (readonly)

Returns the value of attribute left.



217
218
219
# File 'lib/rooq/dsl/select_query.rb', line 217

def left
  @left
end

#operatorObject (readonly)

Returns the value of attribute operator.



217
218
219
# File 'lib/rooq/dsl/select_query.rb', line 217

def operator
  @operator
end

#rightObject (readonly)

Returns the value of attribute right.



217
218
219
# File 'lib/rooq/dsl/select_query.rb', line 217

def right
  @right
end

Instance Method Details

#except(other, all: false) ⇒ Object



240
241
242
# File 'lib/rooq/dsl/select_query.rb', line 240

def except(other, all: false)
  SetOperation.new(:except, self, other, all: all)
end

#intersect(other, all: false) ⇒ Object



236
237
238
# File 'lib/rooq/dsl/select_query.rb', line 236

def intersect(other, all: false)
  SetOperation.new(:intersect, self, other, all: all)
end

#order_by(*specs) ⇒ Object



244
245
246
# File 'lib/rooq/dsl/select_query.rb', line 244

def order_by(*specs)
  OrderedSetOperation.new(self, specs.flatten)
end

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



227
228
229
# File 'lib/rooq/dsl/select_query.rb', line 227

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

#union(other, all: false) ⇒ Object

Allow chaining



232
233
234
# File 'lib/rooq/dsl/select_query.rb', line 232

def union(other, all: false)
  SetOperation.new(:union, self, other, all: all)
end