Class: Webhookdb::Replicator::IcalendarCalendarV1::Upserter

Inherits:
Object
  • Object
show all
Includes:
Backfiller::Bulk
Defined in:
lib/webhookdb/replicator/icalendar_calendar_v1.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Backfiller::Bulk

#dry_run?, #flush_pending_inserts, #handle_item, #pending_inserts, #remote_key_column_name, #update_where_expr, #upsert_update_expr

Constructor Details

#initialize(replicator, calendar_external_id, now:) ⇒ Upserter

Returns a new instance of Upserter.



153
154
155
156
157
# File 'lib/webhookdb/replicator/icalendar_calendar_v1.rb', line 153

def initialize(replicator, calendar_external_id, now:)
  @upserting_replicator = replicator
  @calendar_external_id = calendar_external_id
  @now = now
end

Instance Attribute Details

#calendar_external_idObject (readonly)

Returns the value of attribute calendar_external_id.



151
152
153
# File 'lib/webhookdb/replicator/icalendar_calendar_v1.rb', line 151

def calendar_external_id
  @calendar_external_id
end

#nowObject (readonly)

Returns the value of attribute now.



151
152
153
# File 'lib/webhookdb/replicator/icalendar_calendar_v1.rb', line 151

def now
  @now
end

#upserting_replicatorObject (readonly)

Returns the value of attribute upserting_replicator.



151
152
153
# File 'lib/webhookdb/replicator/icalendar_calendar_v1.rb', line 151

def upserting_replicator
  @upserting_replicator
end

Instance Method Details

#conditional_upsert?Boolean

Returns:

  • (Boolean)


160
# File 'lib/webhookdb/replicator/icalendar_calendar_v1.rb', line 160

def conditional_upsert? = true

#prepare_body(body) ⇒ Object



162
163
164
165
# File 'lib/webhookdb/replicator/icalendar_calendar_v1.rb', line 162

def prepare_body(body)
  body["calendar_external_id"] = @calendar_external_id
  body["row_updated_at"] = @now
end

#upsert_page_sizeObject



159
# File 'lib/webhookdb/replicator/icalendar_calendar_v1.rb', line 159

def upsert_page_size = 2000