Class: PgCron::Adapters::Postgres::QueryExecutor Private
- Inherits:
-
Object
- Object
- PgCron::Adapters::Postgres::QueryExecutor
- Defined in:
- lib/pg_cron/adapters/postgres/query_executor.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Executes database queries and maps results to domain objects.
Copied from Fx::Adapters::Postgres::QueryExecutor.
Class Method Summary collapse
- .call ⇒ Object private
Instance Method Summary collapse
-
#call ⇒ Array
private
Array of domain objects.
-
#initialize(connection:, query:, model_class:) ⇒ QueryExecutor
constructor
private
A new instance of QueryExecutor.
Constructor Details
#initialize(connection:, query:, model_class:) ⇒ QueryExecutor
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of QueryExecutor.
16 17 18 19 20 |
# File 'lib/pg_cron/adapters/postgres/query_executor.rb', line 16 def initialize(connection:, query:, model_class:) @connection = connection @query = query @model_class = model_class end |
Class Method Details
.call ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 |
# File 'lib/pg_cron/adapters/postgres/query_executor.rb', line 12 def self.call(...) new(...).call end |
Instance Method Details
#call ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Array of domain objects.
23 24 25 |
# File 'lib/pg_cron/adapters/postgres/query_executor.rb', line 23 def call results_from_postgres.map { |result| model_class.new(result) } end |