[Groonga-commit] droonga/fluent-plugin-droonga at da1ef97 [catalog-schema] schema: Add Column#flags

Back to archive index

Yoji Shidara null+****@clear*****
Tue Feb 18 16:19:36 JST 2014


Yoji Shidara	2014-02-18 16:19:36 +0900 (Tue, 18 Feb 2014)

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

  Message:
    schema: Add Column#flags

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

  Modified: lib/droonga/catalog/schema.rb (+17 -0)
===================================================================
--- lib/droonga/catalog/schema.rb    2014-02-18 16:15:47 +0900 (bcfa44a)
+++ lib/droonga/catalog/schema.rb    2014-02-18 16:19:36 +0900 (b601c6d)
@@ -56,6 +56,23 @@ module Droonga
           @data["type"]
         end
 
+        def type_flag
+          case type
+          when "Scalar"
+            "COLUMN_SCALAR"
+          when "Vector"
+            "COLUMN_VECTOR"
+          when "Scalar"
+            "COLUMN_INDEX"
+          else
+            # TODO raise appropriate error
+          end
+        end
+
+        def flags
+          type_flag # TODO merge flags from ColumnIndexOptions
+        end
+
         def value_type
           @data["valueType"]
         end

  Modified: test/unit/catalog/test_schema.rb (+8 -0)
===================================================================
--- test/unit/catalog/test_schema.rb    2014-02-18 16:15:47 +0900 (e5361e0)
+++ test/unit/catalog/test_schema.rb    2014-02-18 16:19:36 +0900 (d0c8737)
@@ -143,6 +143,14 @@ class CatalogSchemaTest < Test::Unit::TestCase
                                    }).type)
       end
 
+      def test_flags
+        assert_equal("COLUMN_SCALAR",
+                     create_column("column_name",
+                                   {
+                                     "type" => "Scalar"
+                                   }).flags)
+      end
+
       def test_value_type
         assert_equal("ShortText",
                      create_column("column_name",
-------------- next part --------------
HTML����������������������������...
Download 



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