Class: Fluent::GroongaOutput::Schema
- Inherits:
-
Object
- Object
- Fluent::GroongaOutput::Schema
- Defined in:
- lib/fluent/plugin/out_groonga.rb,
lib/fluent/plugin/out_groonga.rb
Defined Under Namespace
Classes: Column, Table, TypeGuesser
Instance Method Summary (collapse)
-
- (Schema) initialize(client, table_name, mappings)
constructor
A new instance of Schema.
- - (Object) populate
- - (Object) update(records)
Constructor Details
- (Schema) initialize(client, table_name, mappings)
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
- (Object) populate
88 89 90 |
# File 'lib/fluent/plugin/out_groonga.rb', line 88 def populate # TODO end |
- (Object) update(records)
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 |