Module: SandthornDriverSequel

Defined in:
lib/sandthorn_driver_sequel.rb,
lib/sandthorn_driver_sequel/access.rb,
lib/sandthorn_driver_sequel/storage.rb,
lib/sandthorn_driver_sequel/version.rb,
lib/sandthorn_driver_sequel/migration.rb,
lib/sandthorn_driver_sequel/event_query.rb,
lib/sandthorn_driver_sequel/event_store.rb,
lib/sandthorn_driver_sequel/sequel_driver.rb,
lib/sandthorn_driver_sequel/utilities/array.rb,
lib/sandthorn_driver_sequel/access/event_access.rb,
lib/sandthorn_driver_sequel/event_store_context.rb,
lib/sandthorn_driver_sequel/access/snapshot_access.rb,
lib/sandthorn_driver_sequel/wrappers/event_wrapper.rb,
lib/sandthorn_driver_sequel/access/aggregate_access.rb,
lib/sandthorn_driver_sequel/wrappers/snapshot_wrapper.rb

Defined Under Namespace

Modules: Access, Errors, EventStoreContext, Utilities Classes: AggregateAccess, Configuration, EventAccess, EventQuery, EventStore, EventWrapper, Migration, SequelDriver, SnapshotAccess, SnapshotWrapper, Storage

Constant Summary collapse

VERSION =
"3.2.0"

Class Method Summary collapse

Class Method Details

.configurationObject



53
54
55
# File 'lib/sandthorn_driver_sequel.rb', line 53

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



49
50
51
# File 'lib/sandthorn_driver_sequel.rb', line 49

def configure
  yield(configuration) if block_given?
end

.driver_from_connection(connection: nil, context: nil) ⇒ Object



39
40
41
42
43
44
45
46
47
# File 'lib/sandthorn_driver_sequel.rb', line 39

def driver_from_connection connection: nil, context: nil
  if block_given?
    configuration = Configuration.new
    yield(configuration)
  else
    configuration = self.configuration
  end
  EventStore.new(SequelDriver.new(connection: connection), configuration, context)
end

.driver_from_url(url: nil, context: nil) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/sandthorn_driver_sequel.rb', line 27

def driver_from_url url: nil, context: nil

  if block_given?
    configuration = Configuration.new
    yield(configuration)
  else
    configuration = self.configuration
  end

  EventStore.from_url(url, configuration, context)
end

.migrate_connection(connection:, context: nil) ⇒ Object



23
24
25
# File 'lib/sandthorn_driver_sequel.rb', line 23

def migrate_connection connection:, context: nil
  Migration.new(connection: connection, context: context).migrate!
end

.migrate_db(url: nil, context: nil) ⇒ Object



14
15
16
17
# File 'lib/sandthorn_driver_sequel.rb', line 14

def migrate_db url: nil, context: nil
  migrator = Migration.new url: url, context: context
  migrator.migrate!
end

.migrate_url(url: nil, context: nil) ⇒ Object



19
20
21
# File 'lib/sandthorn_driver_sequel.rb', line 19

def migrate_url url: nil, context: nil
  Migration.new(url: url, context: context).migrate!
end