1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
# -*- ruby -*-
# frozen_string_literal: true
module PG
module TextDecoder
# Convenience classes for timezone options
class TimestampUtc < Timestamp
def initialize(hash={}, **kwargs)
warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_UTC)
end
end
class TimestampUtcToLocal < Timestamp
def initialize(hash={}, **kwargs)
warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_LOCAL)
end
end
class TimestampLocal < Timestamp
def initialize(hash={}, **kwargs)
warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_LOCAL | PG::Coder::TIMESTAMP_APP_LOCAL)
end
end
# For backward compatibility:
TimestampWithoutTimeZone = TimestampLocal
TimestampWithTimeZone = Timestamp
end
end # module PG
|