Module: NexusCqrs::Helpers
- Defined in:
- lib/nexus_cqrs/helpers.rb
Overview
Simple module to inject execution methods into a class. Used to execute commands and queries from controllers and/or graphql resolvers.
Instance Method Summary collapse
-
#command_executor ⇒ NexusCqrs::CommandExecutor
Provide access to the CQRS command executor.
-
#execute(command) ⇒ Object
Executes a CQRS Command.
-
#query(query) ⇒ Object
Executes a CQRS Query.
-
#query_executor ⇒ NexusCqrs::CommandExecutor
Provide access to the CQRS query executor.
Instance Method Details
#command_executor ⇒ NexusCqrs::CommandExecutor
Provide access to the CQRS command executor
27 28 29 |
# File 'lib/nexus_cqrs/helpers.rb', line 27 def command_executor @command_executor ||= $COMMAND_EXECUTOR end |
#execute(command) ⇒ Object
Executes a CQRS Command
11 12 13 |
# File 'lib/nexus_cqrs/helpers.rb', line 11 def execute(command) command_executor.execute(command) end |
#query(query) ⇒ Object
Executes a CQRS Query
20 21 22 |
# File 'lib/nexus_cqrs/helpers.rb', line 20 def query(query) query_executor.execute(query) end |
#query_executor ⇒ NexusCqrs::CommandExecutor
Provide access to the CQRS query executor
34 35 36 |
# File 'lib/nexus_cqrs/helpers.rb', line 34 def query_executor @query_executor ||= $QUERY_EXECUTOR end |