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.
-
#snapshots ⇒ Object
Returns a Sequel::Model for accessing snapshots.
- #snapshots_table ⇒ Object
Methods included from EventStoreContext
#aggregates_table_name, #events_table_name, #snapshots_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
33 34 35 |
# File 'lib/sandthorn_driver_sequel/storage.rb', line 33 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
37 38 39 |
# File 'lib/sandthorn_driver_sequel/storage.rb', line 37 def events_table db[events_table_name] end |
#snapshots ⇒ Object
Returns a Sequel::Model for accessing snapshots
29 30 31 |
# File 'lib/sandthorn_driver_sequel/storage.rb', line 29 def snapshots Class.new(Sequel::Model(snapshots_table)) end |
#snapshots_table ⇒ Object
41 42 43 |
# File 'lib/sandthorn_driver_sequel/storage.rb', line 41 def snapshots_table db[snapshots_table_name] end |