Class: Lhm::IdSetChunkInsert
- Inherits:
-
Object
- Object
- Lhm::IdSetChunkInsert
- Defined in:
- lib/lhm/id_set_chunk_insert.rb
Constant Summary collapse
- LOG_PREFIX =
"ChunkInsert"
Instance Method Summary collapse
- #bottom ⇒ Object
- #expected_rows ⇒ Object
-
#initialize(migration, connection, ids, retry_options = {}) ⇒ IdSetChunkInsert
constructor
A new instance of IdSetChunkInsert.
- #insert_and_return_count_of_rows_created ⇒ Object
- #top ⇒ Object
Constructor Details
#initialize(migration, connection, ids, retry_options = {}) ⇒ IdSetChunkInsert
Returns a new instance of IdSetChunkInsert.
9 10 11 12 13 14 |
# File 'lib/lhm/id_set_chunk_insert.rb', line 9 def initialize(migration, connection, ids, = {}) @migration = migration @connection = connection @ids = ids @retry_options = end |
Instance Method Details
#bottom ⇒ Object
20 21 22 |
# File 'lib/lhm/id_set_chunk_insert.rb', line 20 def bottom @ids[0] end |
#expected_rows ⇒ Object
28 29 30 |
# File 'lib/lhm/id_set_chunk_insert.rb', line 28 def expected_rows @ids.length end |
#insert_and_return_count_of_rows_created ⇒ Object
16 17 18 |
# File 'lib/lhm/id_set_chunk_insert.rb', line 16 def insert_and_return_count_of_rows_created @connection.update(sql, should_retry: true, log_prefix: LOG_PREFIX) end |
#top ⇒ Object
24 25 26 |
# File 'lib/lhm/id_set_chunk_insert.rb', line 24 def top @ids[-1] end |