Class: ClickHouse::Type::BooleanType

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

Constant Summary collapse

TRUE_VALUE =
1
FALSE_VALUE =
0

Instance Method Summary collapse

Instance Method Details

#cast(value) ⇒ Object


9
10
11
# File 'lib/click_house/type/boolean_type.rb', line 9

def cast(value)
  value.to_i == TRUE_VALUE
end

#serialize(value) ⇒ Object


13
14
15
# File 'lib/click_house/type/boolean_type.rb', line 13

def serialize(value)
  value ? TRUE_VALUE : FALSE_VALUE
end