class ReportsKits::Reports::Adapters::Postgresql
Public Class Methods
truncate_to_day(column)
click to toggle source
# File lib/reports_kits/reports/adapters/postgresql.rb, line 5 def self.truncate_to_day(column) "#{column}::date" end
truncate_to_month(column)
click to toggle source
# File lib/reports_kits/reports/adapters/postgresql.rb, line 20 def self.truncate_to_month(column) "DATE_TRUNC('month', #{column}::date)" end
truncate_to_week(column)
click to toggle source
# File lib/reports_kits/reports/adapters/postgresql.rb, line 9 def self.truncate_to_week(column) case ReportsKits.configuration.first_day_of_week when :sunday "DATE_TRUNC('week', #{column}::timestamp + '1 day'::interval) - '1 day'::interval" when :monday "DATE_TRUNC('week', #{column}::timestamp)" else raise ArgumentError.new("Unsupported first_day_of_week: #{ReportsKits.configuration.first_day_of_week}") end end