Class: Fx::Adapters::Postgres::Aggregates Private
- Inherits:
-
Object
- Object
- Fx::Adapters::Postgres::Aggregates
- Defined in:
- lib/fx-aggregate/adapters/postgres/aggregates.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.
Fetches defined aggregates from the postgres connection.
Constant Summary collapse
- AGGREGATES_WITH_DEFINITIONS_QUERY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The SQL query used by F(x) to retrieve the aggregates considered dumpable into
db/schema.rb. <<-EOS.freeze SELECT pp.proname AS name, pg_get_function_identity_arguments(pp.oid) AS arguments, pa.*, format_type(pa.aggtranstype, null) AS aggtranstype, format_type(pa.aggmtranstype, null) AS aggmtranstype FROM pg_proc pp JOIN pg_aggregate pa ON pa.aggfnoid = pp.oid JOIN pg_namespace pn ON pn.oid = pp.pronamespace LEFT JOIN pg_depend pd ON pd.objid = pp.oid AND pd.deptype = 'e' WHERE pn.nspname = 'public' AND pd.objid IS NULL ORDER BY pp.oid; EOS
Class Method Summary collapse
-
.all(*args) ⇒ Array<Fx::Aggregate>
private
Wraps #all as a static facade.
Instance Method Summary collapse
-
#all ⇒ Array<Fx::Aggregate>
private
All of the aggregates that this connection has defined.
-
#initialize(connection) ⇒ Aggregates
constructor
private
A new instance of Aggregates.
Constructor Details
#initialize(connection) ⇒ Aggregates
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 Aggregates.
36 37 38 |
# File 'lib/fx-aggregate/adapters/postgres/aggregates.rb', line 36 def initialize(connection) @connection = connection end |
Class Method Details
.all(*args) ⇒ Array<Fx::Aggregate>
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.
Wraps #all as a static facade.
32 33 34 |
# File 'lib/fx-aggregate/adapters/postgres/aggregates.rb', line 32 def self.all(*args) new(*args).all end |
Instance Method Details
#all ⇒ Array<Fx::Aggregate>
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.
All of the aggregates that this connection has defined.
43 44 45 |
# File 'lib/fx-aggregate/adapters/postgres/aggregates.rb', line 43 def all aggregates_from_postgres.map { |aggregate| to_fx_aggregate(aggregate) } end |