Class: Fluent::BigQuery::TimestampFieldSchema
Constant Summary
collapse
- INTEGER_REGEXP =
/\A-?[[:digit:]]+\z/.freeze
- FLOAT_REGEXP =
/\A-?[[:digit:]]+(\.[[:digit:]]+)\z/.freeze
Instance Attribute Summary
Attributes inherited from FieldSchema
#mode, #name
Instance Method Summary
collapse
Methods inherited from FieldSchema
#format, #initialize, #to_h
Instance Method Details
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# File 'lib/fluent/plugin/bigquery/schema.rb', line 107
def format_one(value)
case value
when Time
value.strftime("%Y-%m-%d %H:%M:%S.%6L %:z")
when String
if value =~ INTEGER_REGEXP
value.to_i
elsif value =~ FLOAT_REGEXP
value.to_f
else
value
end
else
value
end
end
|
#type ⇒ Object
103
104
105
|
# File 'lib/fluent/plugin/bigquery/schema.rb', line 103
def type
:timestamp
end
|