Sha256: 76ccad3e7ff6ed4c74c2f07d197afd11f1d67800f6d978b29ab1010d6f27aab4
Contents?: true
Size: 749 Bytes
Versions: 2
Compression:
Stored size: 749 Bytes
Contents
module ReportsKits module Reports module Adapters class Postgresql def self.truncate_to_day(column) "#{column}::date" end 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 def self.truncate_to_month(column) "DATE_TRUNC('month', #{column}::date)" end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
reports_kits-0.7.8 | lib/reports_kits/reports/adapters/postgresql.rb |
reports_kits-0.7.7 | lib/reports_kits/reports/adapters/postgresql.rb |