Class: ActiveReporter::Aggregator::Count

Inherits:
Base
  • Object
show all
Defined in:
lib/active_reporter/aggregator/count.rb

Direct Known Subclasses

CountIf

Instance Attribute Summary

Attributes inherited from Base

#name, #opts, #report

Instance Method Summary collapse

Methods inherited from Base

#aggregate, #initialize, #sql_value_name

Constructor Details

This class inherits a constructor from ActiveReporter::Aggregator::Base

Instance Method Details

#default_valueObject



8
9
10
# File 'lib/active_reporter/aggregator/count.rb', line 8

def default_value
  super || 0
end

#functionObject



4
5
6
# File 'lib/active_reporter/aggregator/count.rb', line 4

def function
  "COUNT(#{'DISTINCT' if distinct} #{expression})"
end