class Fluent::BigQuery::TimestampFieldSchema

Constants

FLOAT_REGEXP
INTEGER_REGEXP

Public Instance Methods

format_one(value) click to toggle source
# File lib/fluent/plugin/bigquery/schema.rb, line 117
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() click to toggle source
# File lib/fluent/plugin/bigquery/schema.rb, line 113
def type
  :timestamp
end