class Fluent::BigQueryOutput::TimestampFieldSchema

Constants

FLOAT_REGEXP
INTEGER_REGEXP

Public Instance Methods

format_one(value) click to toggle source
# File lib/fluent/plugin/out_bigquery.rb, line 737
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
      begin
        Time.parse(value).strftime("%Y-%m-%d %H:%M:%S.%6L %:z")
      rescue
        value
      end
    end
  else
    value
  end
end
type() click to toggle source
# File lib/fluent/plugin/out_bigquery.rb, line 733
def type
  :timestamp
end