Class: Fluent::GroongaOutput::Schema
- Inherits:
-
Object
- Object
- Fluent::GroongaOutput::Schema
- Defined in:
- lib/fluent/plugin/out_groonga.rb
Defined Under Namespace
Classes: Column, Table, TypeGuesser
Instance Method Summary collapse
-
#initialize(client, table_name, mappings) ⇒ Schema
constructor
A new instance of Schema.
- #update(records) ⇒ Object
Constructor Details
#initialize(client, table_name, mappings) ⇒ Schema
284 285 286 287 288 289 290 |
# File 'lib/fluent/plugin/out_groonga.rb', line 284 def initialize(client, table_name, mappings) @client = client @table_name = table_name @mappings = mappings @taget_table = nil @columns = nil end |
Instance Method Details
#update(records) ⇒ Object
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/fluent/plugin/out_groonga.rb', line 292 def update(records) ensure_table ensure_columns nonexistent_columns = {} records.each do |record| record.each do |key, value| column = @columns[key] if column.nil? nonexistent_columns[key] ||= [] nonexistent_columns[key] << value end end end nonexistent_columns.each do |name, values| @columns[name] = create_column(name, values) end end |