Class: SandthornDriverSequel2::EventQuery
- Inherits:
-
Object
- Object
- SandthornDriverSequel2::EventQuery
- Defined in:
- lib/sandthorn_driver_sequel_2/event_query.rb
Instance Method Summary collapse
- #build(aggregate_types: [], 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_sequel_2/event_query.rb', line 3 def initialize(storage) @storage = storage end |
Instance Method Details
#build(aggregate_types: [], take: 0, after_sequence_number: 0) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sandthorn_driver_sequel_2/event_query.rb', line 7 def build( aggregate_types: [], take: 0, after_sequence_number: 0) aggregate_types.map!(&:to_s) query = storage.events query = add_aggregate_types(query, aggregate_types) 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
22 23 24 |
# File 'lib/sandthorn_driver_sequel_2/event_query.rb', line 22 def events @query.all end |