Sha256: 014d0ceb454870adf8dd6720d999fd255b3d5027123a091b6f6a4b9c3b65fe1c
Contents?: true
Size: 771 Bytes
Versions: 2
Compression:
Stored size: 771 Bytes
Contents
module ReportsKit module Reports module Adapters class Mysql def self.truncate_to_day(column) "DATE(#{column})" end def self.truncate_to_week(column) case ReportsKit.configuration.first_day_of_week when :sunday "DATE_SUB(DATE(#{column}), INTERVAL DAYOFWEEK(#{column}) - 1 DAY)" when :monday "DATE_SUB(DATE(#{column}), INTERVAL DAYOFWEEK(#{column}) - 2 DAY)" else raise ArgumentError.new("Unsupported first_day_of_week: #{ReportsKit.configuration.first_day_of_week}") end end def self.truncate_to_month(column) "DATE_SUB(DATE(#{column}), INTERVAL DAY(#{column}) - 1 DAY)" 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/mysql.rb |
reports_kit-0.7.0 | lib/reports_kit/reports/adapters/mysql.rb |