Class: PgDice::PeriodFetcher
- Inherits:
-
Object
- Object
- PgDice::PeriodFetcher
- Defined in:
- lib/pgdice/period_fetcher.rb
Overview
Used to find the period of a postgres table using the comment on the table created by pgslice
Instance Method Summary collapse
- #call(params) ⇒ Object
-
#initialize(query_executor:) ⇒ PeriodFetcher
constructor
A new instance of PeriodFetcher.
Constructor Details
#initialize(query_executor:) ⇒ PeriodFetcher
Returns a new instance of PeriodFetcher.
6 7 8 |
# File 'lib/pgdice/period_fetcher.rb', line 6 def initialize(query_executor:) @query_executor = query_executor end |
Instance Method Details
#call(params) ⇒ Object
10 11 12 13 14 |
# File 'lib/pgdice/period_fetcher.rb', line 10 def call(params) sql = build_table_comment_sql(params.fetch(:table_name), params.fetch(:schema)) values = @query_executor.call(sql) convert_comment_to_hash(values.first)[:period] end |