Module: Sequent

Defined in:
lib/version.rb,
lib/sequent/cli/app.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/internal/internal.rb,
lib/sequent/migrations/errors.rb,
lib/sequent/application_record.rb,
lib/sequent/core/current_event.rb,
lib/sequent/core/stream_record.rb,
lib/sequent/migrations/grouper.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/core/snapshot_store.rb,
lib/sequent/dry_run/view_schema.rb,
lib/sequent/generator/aggregate.rb,
lib/sequent/internal/event_type.rb,
lib/sequent/migrations/executor.rb,
lib/sequent/migrations/versions.rb,
lib/sequent/core/aggregate_roots.rb,
lib/sequent/core/command_service.rb,
lib/sequent/core/event_publisher.rb,
lib/sequent/core/snapshot_record.rb,
lib/sequent/migrations/functions.rb,
lib/sequent/rake/migration_tasks.rb,
lib/sequent/test/time_comparison.rb,
lib/sequent/util/web/clear_cache.rb,
lib/sequent/core/helpers/copyable.rb,
lib/sequent/core/helpers/mergable.rb,
lib/sequent/core/middleware/chain.rb,
lib/sequent/internal/command_type.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/cli/sequent_8_migration.rb,
lib/sequent/internal/aggregate_type.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/helpers/pgsql_helpers.rb,
lib/sequent/core/random_uuid_generator.rb,
lib/sequent/internal/partitioned_event.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/internal/partitioned_command.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/internal/partitioned_aggregate.rb,
lib/sequent/core/helpers/autoset_attributes.rb,
lib/sequent/core/helpers/default_validators.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/dry_run/read_only_replay_optimized_postgres_persistor.rb,
lib/sequent/core/transactions/read_only_active_record_transaction_provider.rb

Defined Under Namespace

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

Constant Summary collapse

VERSION =
'8.0.1'
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



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

def self.aggregate_repository
  configuration.aggregate_repository
end

.command_serviceObject

Short hand for Sequent.configuration.command_service



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

def self.command_service
  configuration.command_service
end

.configurationObject



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

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:



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

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

.dry_run(*commands) ⇒ Object



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

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

.loggerObject

Short hand for Sequent.configuration.logger



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

def self.logger
  configuration.logger
end

.migration_classObject



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

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

.new_uuidObject



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

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

.new_versionObject



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

def self.new_version
  migration_class.version
end