[Groonga-commit] ranguba/rroonga at ed077c5 [master] groonga-database-inspector: show column value type

Back to archive index

Kouhei Sutou null+****@clear*****
Sun May 31 17:00:23 JST 2015


Kouhei Sutou	2015-05-31 17:00:23 +0900 (Sun, 31 May 2015)

  New Revision: ed077c5e7502cad8d166d677fdbb78d87be96c3f
  https://github.com/ranguba/rroonga/commit/ed077c5e7502cad8d166d677fdbb78d87be96c3f

  Message:
    groonga-database-inspector: show column value type

  Modified files:
    lib/groonga/database-inspector.rb
    test/test-database-inspector.rb

  Modified: lib/groonga/database-inspector.rb (+11 -0)
===================================================================
--- lib/groonga/database-inspector.rb    2015-05-23 22:01:24 +0900 (18ff98f)
+++ lib/groonga/database-inspector.rb    2015-05-31 17:00:23 +0900 (623a116)
@@ -158,6 +158,9 @@ module Groonga
         indent do
           write("ID:         #{column.id}\n")
           write("Type:       #{inspect_column_type(column)}\n")
+          unless column.index?
+            write("Value type: #{inspect_value_type(column.range)}\n")
+          end
           write("Path:       #{inspect_path(column.path)}\n")
           write("Disk usage: #{inspect_sub_disk_usage(column.disk_usage)}\n")
         end
@@ -265,6 +268,14 @@ module Groonga
         end
       end
 
+      def inspect_value_type(range)
+        if range.nil?
+          "(no value)"
+        else
+          range.name
+        end
+      end
+
       def inspect_tokenizer(table)
         if table.support_key?
           tokenizer = table.default_tokenizer

  Modified: test/test-database-inspector.rb (+15 -1)
===================================================================
--- test/test-database-inspector.rb    2015-05-23 22:01:24 +0900 (ae24f1d)
+++ test/test-database-inspector.rb    2015-05-31 17:00:23 +0900 (96a7c6a)
@@ -144,6 +144,7 @@ class DatabaseInspectorTest < Test::Unit::TestCase
         #{column.local_name}:
           ID:         #{column.id}
           Type:       #{inspect_column_type(column)}
+          Value type: #{inspect_value_type(column.range)}
           Path:       <#{column.path}>
           Disk usage: #{inspect_sub_disk_usage(column.disk_usage)}
     INSPECTED
@@ -164,6 +165,14 @@ class DatabaseInspectorTest < Test::Unit::TestCase
     end
   end
 
+  def inspect_value_type(range)
+    if range.nil?
+      "(no value)"
+    else
+      range.name
+    end
+  end
+
   class DatabaseTest < self
     def test_empty
       assert_equal(<<-INSPECTED, report)
@@ -713,10 +722,15 @@ Database
       end
 
       def inspected(type)
+        if type != "index"
+          value_type = "\n  Value type: #{@column.range.name}"
+        else
+          value_type = ""
+        end
         <<-INSPECTED
 #{@column.local_name}:
   ID:         #{@column.id}
-  Type:       #{type}
+  Type:       #{type}#{value_type}
   Path:       <#{@column.path}>
   Disk usage: #{inspect_sub_disk_usage(@column.disk_usage)}
         INSPECTED
-------------- next part --------------
HTML����������������������������...
Download 



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