Class: ActiveRecord::ConnectionAdapters::Clickhouse::OID::DateTime

Inherits:
Type::DateTime
  • Object
show all
Defined in:
lib/active_record/connection_adapters/clickhouse/oid/date_time.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#serialize(value) ⇒ Object



9
10
11
12
13
14
# File 'lib/active_record/connection_adapters/clickhouse/oid/date_time.rb', line 9

def serialize(value)
  value = super
  return unless value

  value.strftime('%Y-%m-%d %H:%M:%S' + (@precision.present? && @precision > 0 ? ".%#{@precision}N" : ''))
end

#type_cast_for_schema(value) ⇒ Object

Type cast a value for schema dumping. This method is private, as we are hoping to remove it entirely.



22
23
24
# File 'lib/active_record/connection_adapters/clickhouse/oid/date_time.rb', line 22

def type_cast_for_schema(value) # :nodoc:
  value.inspect
end

#type_cast_from_database(value) ⇒ Object



16
17
18
# File 'lib/active_record/connection_adapters/clickhouse/oid/date_time.rb', line 16

def type_cast_from_database(value)
  value
end