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.
953 954 955 956 957 958 959 960 961 962 963 |
# File 'lib/parade_db/search_methods.rb', line 953 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.
940 941 942 |
# File 'lib/parade_db/search_methods.rb', line 940 def connection @connection end |
#relation ⇒ Object (readonly)
Returns the value of attribute relation.
940 941 942 |
# File 'lib/parade_db/search_methods.rb', line 940 def relation @relation end |
Class Method Details
.build(relation:, primary_key:, builder:, agg_specs:, exact:, connection:) ⇒ Object
942 943 944 945 946 947 948 949 950 951 |
# File 'lib/parade_db/search_methods.rb', line 942 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
969 970 971 972 |
# File 'lib/parade_db/search_methods.rb', line 969 def execute row = connection.select_one(sql) parse_aggregates(row) end |
#sql ⇒ Object
965 966 967 |
# File 'lib/parade_db/search_methods.rb', line 965 def sql relation.to_sql end |