Module: Sequent

Defined in:
lib/version.rb,
lib/sequent/sequent.rb,
lib/sequent/core/event.rb,
lib/sequent/util/timer.rb,
lib/sequent/core/command.rb,
lib/sequent/util/dry_run.rb,
lib/sequent/util/printer.rb,
lib/sequent/configuration.rb,
lib/sequent/core/workflow.rb,
lib/sequent/core/projector.rb,
lib/sequent/migrations/sql.rb,
lib/sequent/core/sequent_oj.rb,
lib/sequent/generator/event.rb,
lib/sequent/core/event_store.rb,
lib/sequent/support/database.rb,
lib/sequent/core/event_record.rb,
lib/sequent/core/value_object.rb,
lib/sequent/generator/command.rb,
lib/sequent/generator/project.rb,
lib/sequent/application_record.rb,
lib/sequent/core/current_event.rb,
lib/sequent/core/stream_record.rb,
lib/sequent/migrations/planner.rb,
lib/sequent/core/aggregate_root.rb,
lib/sequent/core/command_record.rb,
lib/sequent/core/helpers/secret.rb,
lib/sequent/generator/aggregate.rb,
lib/sequent/migrations/executor.rb,
lib/sequent/support/view_schema.rb,
lib/sequent/core/aggregate_roots.rb,
lib/sequent/core/command_service.rb,
lib/sequent/core/event_publisher.rb,
lib/sequent/migrations/functions.rb,
lib/sequent/rake/migration_tasks.rb,
lib/sequent/test/time_comparison.rb,
lib/sequent/core/helpers/copyable.rb,
lib/sequent/core/helpers/mergable.rb,
lib/sequent/core/middleware/chain.rb,
lib/sequent/migrations/migrations.rb,
lib/sequent/migrations/projectors.rb,
lib/sequent/test/database_helpers.rb,
lib/sequent/test/workflow_helpers.rb,
lib/sequent/migrations/view_schema.rb,
lib/sequent/support/view_projection.rb,
lib/sequent/core/helpers/uuid_helper.rb,
lib/sequent/core/aggregate_repository.rb,
lib/sequent/core/base_command_handler.rb,
lib/sequent/core/persistors/persistor.rb,
lib/sequent/migrations/sequent_schema.rb,
lib/sequent/test/event_stream_helpers.rb,
lib/sequent/core/aggregate_snapshotter.rb,
lib/sequent/core/helpers/equal_support.rb,
lib/sequent/core/helpers/param_support.rb,
lib/sequent/core/random_uuid_generator.rb,
lib/sequent/core/helpers/date_validator.rb,
lib/sequent/core/helpers/message_router.rb,
lib/sequent/core/helpers/string_support.rb,
lib/sequent/core/helpers/time_validator.rb,
lib/sequent/core/helpers/array_with_type.rb,
lib/sequent/core/helpers/message_handler.rb,
lib/sequent/test/command_handler_helpers.rb,
lib/sequent/core/helpers/string_validator.rb,
lib/sequent/core/helpers/value_validators.rb,
lib/sequent/core/helpers/attr_matchers/dsl.rb,
lib/sequent/core/helpers/attribute_support.rb,
lib/sequent/core/helpers/boolean_validator.rb,
lib/sequent/core/helpers/autoset_attributes.rb,
lib/sequent/core/helpers/default_validators.rb,
lib/sequent/core/helpers/message_dispatcher.rb,
lib/sequent/util/skip_if_already_processing.rb,
lib/sequent/core/helpers/date_time_validator.rb,
lib/sequent/core/helpers/attr_matchers/equals.rb,
lib/sequent/core/helpers/message_matchers/any.rb,
lib/sequent/core/helpers/message_matchers/dsl.rb,
lib/sequent/core/transactions/no_transactions.rb,
lib/sequent/core/helpers/association_validator.rb,
lib/sequent/core/helpers/message_matchers/is_a.rb,
lib/sequent/core/helpers/attr_matchers/less_than.rb,
lib/sequent/core/helpers/string_to_value_parsers.rb,
lib/sequent/core/helpers/type_conversion_support.rb,
lib/sequent/core/helpers/attr_matchers/not_equals.rb,
lib/sequent/core/helpers/attr_matchers/greater_than.rb,
lib/sequent/core/helpers/message_matchers/has_attrs.rb,
lib/sequent/core/persistors/active_record_persistor.rb,
lib/sequent/core/helpers/message_matchers/except_opt.rb,
lib/sequent/core/helpers/message_matchers/instance_of.rb,
lib/sequent/core/helpers/attr_matchers/less_than_equals.rb,
lib/sequent/core/helpers/message_handler_option_registry.rb,
lib/sequent/core/helpers/attr_matchers/argument_serializer.rb,
lib/sequent/core/helpers/attr_matchers/greater_than_equals.rb,
lib/sequent/core/helpers/message_matchers/argument_coercer.rb,
lib/sequent/core/helpers/message_matchers/argument_serializer.rb,
lib/sequent/core/persistors/replay_optimized_postgres_persistor.rb,
lib/sequent/core/transactions/active_record_transaction_provider.rb,
lib/sequent/core/transactions/read_only_active_record_transaction_provider.rb

Defined Under Namespace

Modules: Core, Generator, Migrations, Rake, Support, Test, Util Classes: ApplicationRecord, Configuration

Constant Summary collapse

VERSION =
'7.0.0'
Event =

Shortcut classes for easy usage

Sequent::Core::Event
Command =
Sequent::Core::Command
CommandHandler =
Sequent::Core::BaseCommandHandler
AggregateRoot =
Sequent::Core::AggregateRoot
Projector =
Sequent::Core::Projector
Workflow =
Sequent::Core::Workflow
ValueObject =
Sequent::Core::ValueObject
Secret =

Shortcut

Core::Helpers::Secret

Class Method Summary collapse

Class Method Details

.aggregate_repositoryObject

Short hand for Sequent.configuration.aggregate_repository



58
59
60
# File 'lib/sequent/sequent.rb', line 58

def self.aggregate_repository
  configuration.aggregate_repository
end

.command_serviceObject

Short hand for Sequent.configuration.command_service



40
41
42
# File 'lib/sequent/sequent.rb', line 40

def self.command_service
  configuration.command_service
end

.configurationObject



35
36
37
# File 'lib/sequent/sequent.rb', line 35

def self.configuration
  Configuration.instance
end

.configure {|Configuration.instance| ... } ⇒ Object

Setup Sequent.

Setup is typically called in an initializer or setup phase of your application. A minimal setup could look like this:

Sequent.configure do |config|
  config.enable_autoregistration = true
end

Calling configure a second time will create a new configuration

Yields:



29
30
31
32
33
# File 'lib/sequent/sequent.rb', line 29

def self.configure
  Configuration.reset
  yield Configuration.instance
  Configuration.instance.autoregister!
end

.dry_run(*commands) ⇒ Object



62
63
64
# File 'lib/sequent/sequent.rb', line 62

def self.dry_run(*commands)
  Sequent::Util::DryRun.these_commands(commands)
end

.loggerObject

Short hand for Sequent.configuration.logger



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

def self.logger
  configuration.logger
end

.migration_classObject



48
49
50
# File 'lib/sequent/sequent.rb', line 48

def self.migration_class
  Class.const_get(configuration.migrations_class_name)
end

.new_uuidObject



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

def self.new_uuid
  Sequent.configuration.uuid_generator.uuid
end

.new_versionObject



44
45
46
# File 'lib/sequent/sequent.rb', line 44

def self.new_version
  migration_class.version
end