Sha256: cf6931d7ce92a47e92eaca716c22f0909cbf78739864f9f39f4c934b1e0ed65c
Contents?: true
Size: 746 Bytes
Versions: 2
Compression:
Stored size: 746 Bytes
Contents
module ReportsKit module Reports module Adapters class Postgresql def self.truncate_to_day(column) "#{column}::date" end def self.truncate_to_week(column) case ReportsKit.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: #{ReportsKit.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_kit-0.7.1 | lib/reports_kit/reports/adapters/postgresql.rb |
reports_kit-0.7.0 | lib/reports_kit/reports/adapters/postgresql.rb |