Class: Sequent::Core::TenantEventStore
- Inherits:
-
EventStore
- Object
- EventStore
- Sequent::Core::TenantEventStore
- Defined in:
- lib/sequent/core/tenant_event_store.rb
Instance Method Summary collapse
Methods inherited from EventStore
#commit_events, configure, #initialize, #load_events, #replay_events
Constructor Details
This class inherits a constructor from Sequent::Core::EventStore
Instance Method Details
#replay_events_for(organization_id) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/sequent/core/tenant_event_store.rb', line 8 def replay_events_for(organization_id) replay_events do aggregate_ids = @record_class.connection.select_all("select distinct aggregate_id from #{@record_class.table_name} where organization_id = '#{organization_id}'").map { |hash| hash["aggregate_id"] } @record_class.connection.select_all("select id, event_type, event_json from #{@record_class.table_name} where aggregate_id in (#{aggregate_ids.map { |id| %Q{'#{id}'} }.join(",")}) order by id") end end |