Class: SandthornDriverEventStore::EventQuery
- Inherits:
-
Object
- Object
- SandthornDriverEventStore::EventQuery
- Defined in:
- lib/sandthorn_driver_event_store/event_query.rb
Instance Method Summary collapse
- #build(stream_name:, take: 0, after_sequence_number: 0) ⇒ Object
- #events ⇒ Object
-
#initialize(storage) ⇒ EventQuery
constructor
A new instance of EventQuery.
Constructor Details
#initialize(storage) ⇒ EventQuery
Returns a new instance of EventQuery.
3 4 5 |
# File 'lib/sandthorn_driver_event_store/event_query.rb', line 3 def initialize(storage) @storage = storage end |
Instance Method Details
#build(stream_name:, take: 0, after_sequence_number: 0) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/sandthorn_driver_event_store/event_query.rb', line 7 def build( stream_name:, take: 0, after_sequence_number: 0) query = storage.events query = add_sequence_number(query, after_sequence_number) query = add_select(query) query = add_limit(query, take) @query = query.order(:sequence_number) end |
#events ⇒ Object
19 20 21 |
# File 'lib/sandthorn_driver_event_store/event_query.rb', line 19 def events @query.all end |