Sha256: 85bab3abd2863cdd22bf6d9b474658b15a29676d028fa401f9ed15987029ef40
Contents?: true
Size: 751 Bytes
Versions: 1
Compression:
Stored size: 751 Bytes
Contents
# frozen_string_literal: true module PhobosDBCheckpoint class Event < ActiveRecord::Base include PhobosDBCheckpoint::EventHelper after_initialize :assign_checksum scope :order_by_event_time_and_created_at, lambda { order('event_time desc nulls last', 'created_at desc nulls last') } def exists? Event.where(topic: topic, group_id: group_id, checksum: checksum).exists? end def acknowledge!(ack) self.entity_id = ack.entity_id self.event_time = ack.event_time self.event_type = ack.event_type self.event_version = ack.event_version save! end private def assign_checksum self.checksum ||= Digest::MD5.hexdigest(payload.to_json) if payload end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
phobos_db_checkpoint-3.4.0 | lib/phobos_db_checkpoint/event.rb |