class Sequent::Core::CommandRecord

For storing Sequent::Core::Command in the database using active_record

Public Instance Methods

children() click to toggle source
# File lib/sequent/core/command_record.rb, line 55
def children
  event_records
end
find_origin(record) click to toggle source
# File lib/sequent/core/command_record.rb, line 63
def find_origin(record)
  return find_origin(record.parent) if record.parent.present?

  record
end
origin() click to toggle source
# File lib/sequent/core/command_record.rb, line 59
def origin
  parent.present? ? find_origin(parent) : self
end
parent() click to toggle source
# File lib/sequent/core/command_record.rb, line 48
def parent
  EventRecord
    .where(aggregate_id: event_aggregate_id, sequence_number: event_sequence_number)
    .where('event_type != ?', Sequent::Core::SnapshotEvent.name)
    .first
end