Class: Rooq::DSL::JoinBuilder

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

Instance Method Summary collapse

Constructor Details

#initialize(query, type, table, table_alias) ⇒ JoinBuilder

Returns a new instance of JoinBuilder.



159
160
161
162
163
164
# File 'lib/rooq/dsl/select_query.rb', line 159

def initialize(query, type, table, table_alias)
  @query = query
  @type = type
  @table = table
  @table_alias = table_alias
end

Instance Method Details

#on(condition) ⇒ Object



166
167
168
169
# File 'lib/rooq/dsl/select_query.rb', line 166

def on(condition)
  join = Join.new(@type, @table, condition, @table_alias)
  @query.add_join(join)
end

#using(*columns) ⇒ Object



171
172
173
174
# File 'lib/rooq/dsl/select_query.rb', line 171

def using(*columns)
  join = Join.new(@type, @table, nil, @table_alias, using: columns.flatten)
  @query.add_join(join)
end