Class: SandthornDriverSequel::Storage

Inherits:
Object
  • Object
show all
Includes:
EventStoreContext
Defined in:
lib/sandthorn_driver_sequel/storage.rb

Instance Attribute Summary collapse

Attributes included from EventStoreContext

#context

Instance Method Summary collapse

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

#dbObject (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

#aggregatesObject

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_tableObject



33
34
35
# File 'lib/sandthorn_driver_sequel/storage.rb', line 33

def aggregates_table
  db[aggregates_table_name]
end

#eventsObject

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_tableObject



37
38
39
# File 'lib/sandthorn_driver_sequel/storage.rb', line 37

def events_table
  db[events_table_name]
end

#snapshotsObject

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_tableObject



41
42
43
# File 'lib/sandthorn_driver_sequel/storage.rb', line 41

def snapshots_table
  db[snapshots_table_name]
end