Module: Sqlbuilder::Statements::Builders::Postgres::InsertBuilder

Includes:
InsertBuilder
Defined in:
lib/sqlbuilder/statements/builders/postgres/insert_builder.rb

Instance Method Summary collapse

Methods included from InsertBuilder

#build_columns, #build_into, #build_values

Instance Method Details

#build_on_conflictObject



10
11
12
# File 'lib/sqlbuilder/statements/builders/postgres/insert_builder.rb', line 10

def build_on_conflict
  "ON CONFLICT (#{@conflict_target.join(',')})"
end

#build_updateObject



14
15
16
17
18
19
20
# File 'lib/sqlbuilder/statements/builders/postgres/insert_builder.rb', line 14

def build_update
  set_list = @values_to_update.map do |key, value|
    "#{key} = #{@utils.format_value(value)}"
  end

  "DO UPDATE SET #{set_list.join(", ")}"
end