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) ⇒ Schema
constructor
A new instance of Schema.
- #populate ⇒ Object
- #update(records) ⇒ Object
Constructor Details
#initialize(client, table_name) ⇒ Schema
Returns a new instance of Schema.
81 82 83 84 85 86 |
# File 'lib/fluent/plugin/out_groonga.rb', line 81 def initialize(client, table_name) @client = client @table_name = table_name @table = nil @columns = nil end |
Instance Method Details
#populate ⇒ Object
88 89 90 |
# File 'lib/fluent/plugin/out_groonga.rb', line 88 def populate # TODO end |
#update(records) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/fluent/plugin/out_groonga.rb', line 92 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 |