Class: Sqlbuilder::Statements::Postgres::Insert

Inherits:
Insert
  • Object
show all
Includes:
Builders::Postgres::InsertBuilder
Defined in:
lib/sqlbuilder/statements/postgres/insert.rb

Instance Method Summary collapse

Methods inherited from Insert

#columns, #initialize, #into, #record, #values

Methods included from Builders::InsertBuilder

#build_columns, #build_into, #build_values

Constructor Details

This class inherits a constructor from Sqlbuilder::Statements::Insert

Instance Method Details

#buildObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/sqlbuilder/statements/postgres/insert.rb', line 22

def build
  sql = super

  if @conflict_target
    sql << " #{build_on_conflict}"
    sql << " #{build_update}"
  end

  sql
end

#on_conflict(conflict_target) ⇒ Object



10
11
12
13
14
# File 'lib/sqlbuilder/statements/postgres/insert.rb', line 10

def on_conflict(conflict_target)
  @conflict_target = conflict_target

  self
end

#update(values_to_update) ⇒ Object



16
17
18
19
20
# File 'lib/sqlbuilder/statements/postgres/insert.rb', line 16

def update(values_to_update)
  @values_to_update = values_to_update

  self
end