Class: ParadeDB::SearchMethods::AggregationQuery
- Inherits:
-
Object
- Object
- ParadeDB::SearchMethods::AggregationQuery
- Defined in:
- lib/parade_db/search_methods.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#relation ⇒ Object
readonly
Returns the value of attribute relation.
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(relation:, primary_key:, builder:, agg_specs:, exact:, connection:) ⇒ AggregationQuery
constructor
A new instance of AggregationQuery.
- #sql ⇒ Object
Constructor Details
#initialize(relation:, primary_key:, builder:, agg_specs:, exact:, connection:) ⇒ AggregationQuery
Returns a new instance of AggregationQuery.
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 |
# File 'lib/parade_db/search_methods.rb', line 1013 def initialize(relation:, primary_key:, builder:, agg_specs:, exact:, connection:) @connection = connection @agg_specs = agg_specs @relation = build_relation( relation: relation, primary_key: primary_key, builder: builder, agg_specs: agg_specs, exact: exact ) end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
1000 1001 1002 |
# File 'lib/parade_db/search_methods.rb', line 1000 def connection @connection end |
#relation ⇒ Object (readonly)
Returns the value of attribute relation.
1000 1001 1002 |
# File 'lib/parade_db/search_methods.rb', line 1000 def relation @relation end |
Class Method Details
.build(relation:, primary_key:, builder:, agg_specs:, exact:, connection:) ⇒ Object
1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 |
# File 'lib/parade_db/search_methods.rb', line 1002 def self.build(relation:, primary_key:, builder:, agg_specs:, exact:, connection:) new( relation: relation, primary_key: primary_key, builder: builder, agg_specs: agg_specs, exact: exact, connection: connection ) end |
Instance Method Details
#execute ⇒ Object
1029 1030 1031 1032 |
# File 'lib/parade_db/search_methods.rb', line 1029 def execute row = connection.select_one(sql) parse_aggregates(row) end |
#sql ⇒ Object
1025 1026 1027 |
# File 'lib/parade_db/search_methods.rb', line 1025 def sql relation.to_sql end |