Class: SandthornDriverSequel::Storage
- Inherits:
-
Object
- Object
- SandthornDriverSequel::Storage
- Includes:
- EventStoreContext
- Defined in:
- lib/sandthorn_driver_sequel/storage.rb
Instance Attribute Summary collapse
-
#db ⇒ Object
readonly
Returns the value of attribute db.
Attributes included from EventStoreContext
Instance Method Summary collapse
-
#aggregates ⇒ Object
Returns a Sequel::Model for accessing aggregates.
- #aggregates_table ⇒ Object
-
#events ⇒ Object
Returns a Sequel::Model for accessing events.
- #events_table ⇒ Object
-
#initialize(db, context) ⇒ Storage
constructor
A new instance of Storage.
Methods included from EventStoreContext
#aggregates_table_name, #events_table_name, #with_context_if_exists
Constructor Details
#initialize(db, context) ⇒ Storage
Returns a new instance of Storage.
13 14 15 16 |
# File 'lib/sandthorn_driver_sequel/storage.rb', line 13 def initialize(db, context) @db = db @context = context end |
Instance Attribute Details
#db ⇒ Object (readonly)
Returns the value of attribute db.
11 12 13 |
# File 'lib/sandthorn_driver_sequel/storage.rb', line 11 def db @db end |
Instance Method Details
#aggregates ⇒ Object
Returns a Sequel::Model for accessing aggregates
19 20 21 |
# File 'lib/sandthorn_driver_sequel/storage.rb', line 19 def aggregates Class.new(Sequel::Model(aggregates_table)) end |
#aggregates_table ⇒ Object
28 29 30 |
# File 'lib/sandthorn_driver_sequel/storage.rb', line 28 def aggregates_table db[aggregates_table_name] end |
#events ⇒ Object
Returns a Sequel::Model for accessing events
24 25 26 |
# File 'lib/sandthorn_driver_sequel/storage.rb', line 24 def events Class.new(Sequel::Model(events_table)) end |
#events_table ⇒ Object
32 33 34 |
# File 'lib/sandthorn_driver_sequel/storage.rb', line 32 def events_table db[events_table_name] end |