Sha256: 4590e8126e67c9fe33253f58527f22967bb0e75c4ae6048a93119ef30869107b
Contents?: true
Size: 652 Bytes
Versions: 2
Compression:
Stored size: 652 Bytes
Contents
# encoding: utf-8 require "time" require "date" module LogStash module PluginMixins module Jdbc # Provides functions to extract the row's values, ensuring column types # are properly decorated to become coercible to a LogStash::Event. module ValueHandler # Stringify the row keys and decorate values when necessary def extract_values_from(row) Hash[row.map { |k, v| [k.to_s, decorate_value(v)] }] end # Decorate the value so it can be used as a LogStash::Event field def decorate_value(value) case value when Date, DateTime value.to_time else value end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
logstash-integration-jdbc-5.5.1 | lib/logstash/plugin_mixins/jdbc/value_handler.rb |
logstash-integration-jdbc-5.5.0 | lib/logstash/plugin_mixins/jdbc/value_handler.rb |