class Babik::QuerySet::PostgresMySQLAggregationFunction

When a aggregation function is in PostgreSQL and MySQL (main supported databases)

Public Instance Methods

sql_operation() click to toggle source

Return the SQL code operation for this aggregation, e.g.:

- STDDEV_POP(?field)
- VAR_POP(?field)

@raise [RuntimeException] if database has no support for this operation. @return [String] SQL code for the aggregation

# 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