Class: ClickHouse::Type::DecimalType

Inherits:
BaseType
  • Object
show all
Defined in:
lib/click_house/type/decimal_type.rb

Instance Method Summary collapse

Instance Method Details

#cast(value, precision = Float::DIG, _scale = nil) ⇒ Object


6
7
8
# File 'lib/click_house/type/decimal_type.rb', line 6

def cast(value, precision = Float::DIG, _scale = nil)
  BigDecimal(value, precision.to_i)
end

#serialize(value, precision = Float::DIG, _scale = nil) ⇒ Object


10
11
12
# File 'lib/click_house/type/decimal_type.rb', line 10

def serialize(value, precision = Float::DIG, _scale = nil)
  BigDecimal(value, precision.to_i).to_f unless value.nil?
end