Class: Compendium::CountQuery

Inherits:
Query
  • Object
show all
Defined in:
lib/compendium/count_query.rb

Overview

A CountQuery is a Query which runs an SQL count statement Often useful in conjunction with a grouped query

Instance Attribute Summary

Attributes inherited from Query

#filters, #metrics, #name, #options, #proc, #report, #results, #table_settings

Instance Method Summary collapse

Methods inherited from Query

#add_filter, #add_metric, #chart, #empty?, #initialize_clone, #nil?, #ran?, #render_chart, #render_csv, #render_table, #run, #url

Constructor Details

#initialize(*args) ⇒ CountQuery

Returns a new instance of CountQuery.



9
10
11
12
13
# File 'lib/compendium/count_query.rb', line 9

def initialize(*args)
  super

  @options.reverse_merge!(order: 'COUNT(*)', reverse: true)
end