Sha256: 39281248ba0f700e58f7d6453b54618c69e3f4b2a1bce438f4fc9d46db8d4879
Contents?: true
Size: 977 Bytes
Versions: 1
Compression:
Stored size: 977 Bytes
Contents
module SandthornDriverEventStore class EventStore attr_reader :driver def initialize event_store_driver: @driver = event_store_driver driver.execute do |db| @storage = db end end def save_events events, aggregate_id, class_name driver.execute do |db| event_access = get_event_access(db) events = events.map { |event| event[:aggregate_type] = class_name; event[:aggregate_id] = aggregate_id; event;} event_access.store_events(events) end end def find aggregate_id driver.execute do |db| event_access = get_event_access(db) event_access.find_events_by_aggregate_id(aggregate_id) end end def all aggregate_type raise :NotImplemented end def get_events(*args) raise :NotImplemented end private def get_event_access(db) EventAccess.new(storage(db)) end def storage(db) @storage end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sandthorn_driver_event_store-0.0.1 | lib/sandthorn_driver_event_store/event_store.rb |