Class: Webhookdb::Postgres::Maintenance::Count

Inherits:
Query
  • Object
show all
Defined in:
lib/webhookdb/postgres/maintenance.rb

Instance Attribute Summary

Attributes inherited from Base

#service_integration

Instance Method Summary collapse

Methods inherited from Query

#connstr, #fetch

Methods inherited from Base

#conn_params, #debug?, #initialize

Constructor Details

This class inherits a constructor from Webhookdb::Postgres::Maintenance::Base

Instance Method Details

#queryObject



127
# File 'lib/webhookdb/postgres/maintenance.rb', line 127

def query = "SELECT reltuples AS estimate FROM pg_class WHERE relname = '#{self.service_integration.table_name}'"

#runObject



129
130
131
132
# File 'lib/webhookdb/postgres/maintenance.rb', line 129

def run
  r = self.fetch
  return r[0][:estimate].to_i
end

#run_fmtObject



134
# File 'lib/webhookdb/postgres/maintenance.rb', line 134

def run_fmt = ActiveSupport::NumberHelper.number_to_delimited(self.run.to_i)