Class: Babik::QuerySet::PostgresMySQLAggregationFunction
- Inherits:
-
AbstractAggregationFunction
- Object
- AbstractAggregationFunction
- Babik::QuerySet::PostgresMySQLAggregationFunction
- Defined in:
- lib/babik/queryset/components/aggregation.rb
Overview
When a aggregation function is in PostgreSQL and MySQL (main supported databases)
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from AbstractAggregationFunction
#field_name, #model, #selection
Instance Method Summary collapse
-
#sql_operation ⇒ String
Return the SQL code operation for this aggregation, e.g.: - STDDEV_POP(?field) - VAR_POP(?field).
Methods inherited from AbstractAggregationFunction
db_adapter, #initialize, #left_joins_by_alias, #prepare, #sql
Constructor Details
This class inherits a constructor from Babik::QuerySet::AbstractAggregationFunction
Instance Method Details
#sql_operation ⇒ String
Return the SQL code operation for this aggregation, e.g.:
- STDDEV_POP(?field)
- VAR_POP(?field)
144 145 146 147 148 |
# File 'lib/babik/queryset/components/aggregation.rb', line 144 def sql_operation db_adapter = self.class.db_adapter return self.class::SQL_OPERATION if %w[postgresql mysql2].include?(db_adapter) raise "#{db_adapter} has no support for #{self.class} aggregation" end |