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.
1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 |
# File 'lib/parade_db/search_methods.rb', line 1024 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.
1011 1012 1013 |
# File 'lib/parade_db/search_methods.rb', line 1011 def connection @connection end |
#relation ⇒ Object (readonly)
Returns the value of attribute relation.
1011 1012 1013 |
# File 'lib/parade_db/search_methods.rb', line 1011 def relation @relation end |
Class Method Details
.build(relation:, primary_key:, builder:, agg_specs:, exact:, connection:) ⇒ Object
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 |
# File 'lib/parade_db/search_methods.rb', line 1013 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
1040 1041 1042 1043 |
# File 'lib/parade_db/search_methods.rb', line 1040 def execute row = connection.select_one(sql) parse_aggregates(row) end |
#sql ⇒ Object
1036 1037 1038 |
# File 'lib/parade_db/search_methods.rb', line 1036 def sql relation.to_sql end |