[Groonga-commit] droonga/fluent-plugin-droonga at b6583d9 [master] Translate valueType

Back to archive index

Yoji Shidara null+****@clear*****
Wed Feb 26 16:12:18 JST 2014


Yoji Shidara	2014-02-26 16:12:18 +0900 (Wed, 26 Feb 2014)

  New Revision: b6583d9cdefcf2c07778439415369f6f53cd0d07
  https://github.com/droonga/fluent-plugin-droonga/commit/b6583d9cdefcf2c07778439415369f6f53cd0d07

  Message:
    Translate valueType

  Modified files:
    lib/droonga/catalog/schema.rb
    test/unit/catalog/test_schema.rb

  Modified: lib/droonga/catalog/schema.rb (+18 -1)
===================================================================
--- lib/droonga/catalog/schema.rb    2014-02-26 15:37:19 +0900 (fe9f754)
+++ lib/droonga/catalog/schema.rb    2014-02-26 16:12:18 +0900 (cd0b3c9)
@@ -88,6 +88,23 @@ module Droonga
           @data["valueType"]
         end
 
+        def value_type_groonga
+          case value_type
+          when "Integer"
+            "Int64"
+          when "Bool",
+               "Float",
+               "Time",
+               "ShortText",
+               "Text",
+               "TokyoGeoPoint",
+               "WGS84GeoPoint"
+            value_type
+          else
+            # TODO raise appropriate error
+          end
+        end
+
         def to_column_create_body
           body = {
             "name"  => name,
@@ -213,7 +230,7 @@ module Droonga
 
         def tsort_each_child(column, &block)
           dependent_column_names = column.index_options.sources || []
-          reference_table = @tables[column.value_type]
+          reference_table = @tables[column.value_type_groonga]
           dependent_columns = dependent_column_names.collect do |column_name|
             reference_table.columns[column_name]
           end

  Modified: test/unit/catalog/test_schema.rb (+8 -0)
===================================================================
--- test/unit/catalog/test_schema.rb    2014-02-26 15:37:19 +0900 (5c7950e)
+++ test/unit/catalog/test_schema.rb    2014-02-26 16:12:18 +0900 (d506907)
@@ -257,6 +257,14 @@ class CatalogSchemaTest < Test::Unit::TestCase
                                    }).value_type)
       end
 
+      def test_value_type_groonga
+        assert_equal("Int64",
+                     create_column("column_name",
+                                   {
+                                     "valueType" => "Integer"
+                                   }).value_type_groonga)
+      end
+
       def test_flags_with_column_index_options
         assert_equal(["COLUMN_SCALAR", "WITH_SECTION"],
                      create_column("column_name",
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index