Class: Rooq::DSL::DeleteQuery

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table) ⇒ DeleteQuery

Returns a new instance of DeleteQuery.



8
9
10
11
12
# File 'lib/rooq/dsl/delete_query.rb', line 8

def initialize(table)
  @table = table
  @conditions = nil
  @returning_fields = []
end

Instance Attribute Details

#conditionsObject (readonly)

Returns the value of attribute conditions.



6
7
8
# File 'lib/rooq/dsl/delete_query.rb', line 6

def conditions
  @conditions
end

#returning_fieldsObject (readonly)

Returns the value of attribute returning_fields.



6
7
8
# File 'lib/rooq/dsl/delete_query.rb', line 6

def returning_fields
  @returning_fields
end

#tableObject (readonly)

Returns the value of attribute table.



6
7
8
# File 'lib/rooq/dsl/delete_query.rb', line 6

def table
  @table
end

Instance Method Details

#returning(*fields) ⇒ Object



18
19
20
# File 'lib/rooq/dsl/delete_query.rb', line 18

def returning(*fields)
  dup_with(returning_fields: fields.flatten)
end

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



22
23
24
# File 'lib/rooq/dsl/delete_query.rb', line 22

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

#where(condition) ⇒ Object



14
15
16
# File 'lib/rooq/dsl/delete_query.rb', line 14

def where(condition)
  dup_with(conditions: condition)
end