Class: Flounder::Query::Insert
- Includes:
- Returning
- Defined in:
- lib/flounder/query/insert.rb
Overview
An insert.
Instance Attribute Summary
Attributes inherited from Base
#bind_values, #domain, #engine, #entity, #manager
Instance Method Summary collapse
-
#initialize(domain, into_entity) ⇒ Insert
constructor
A new instance of Insert.
-
#row(fields) ⇒ Object
Add one row to the inserts.
Methods included from Returning
#returning, #returning_fields, #to_sql
Methods inherited from Base
#column_name_to_entity, #kick, #measure, #parse_conditions, #to_sql, #where, #with
Methods included from Helpers::Entity
#convert_to_entity, #entity_like?
Constructor Details
#initialize(domain, into_entity) ⇒ Insert
Returns a new instance of Insert.
10 11 12 13 14 |
# File 'lib/flounder/query/insert.rb', line 10 def initialize domain, into_entity super domain, Arel::InsertManager, into_entity manager.into entity.table end |
Instance Method Details
#row(fields) ⇒ Object
Add one row to the inserts.
18 19 20 21 22 |
# File 'lib/flounder/query/insert.rb', line 18 def row fields manager.insert( fields.map { |k, v| transform_tuple_for_set(k, v) }) end |