Kosuke Asami
null+****@clear*****
Thu Jul 11 10:54:48 JST 2013
Kosuke Asami 2013-07-11 10:54:48 +0900 (Thu, 11 Jul 2013) New Revision: 4ace99343a0f1789366ac443ae6037f6b72a477d https://github.com/groonga/fluent-plugin-droonga/commit/4ace99343a0f1789366ac443ae6037f6b72a477d Message: Enable "key_type" parameter to "table_create" command Modified files: lib/droonga/plugin/groonga/table_create.rb test/plugin/groonga/test_table_create.rb Modified: lib/droonga/plugin/groonga/table_create.rb (+9 -1) =================================================================== --- lib/droonga/plugin/groonga/table_create.rb 2013-07-11 10:47:32 +0900 (5fbbbd9) +++ lib/droonga/plugin/groonga/table_create.rb 2013-07-11 10:54:48 +0900 (c1c2b3c) @@ -35,7 +35,9 @@ module Droonga private def parse_request(request) - options = parse_flags(request) + options = {} + options.merge!(parse_flags(request)) + options.merge!(parse_key_type(request)) options end @@ -62,6 +64,12 @@ module Droonga end options end + + def parse_key_type(request) + options = {} + options[:key_type] = request["key_type"] if request["key_type"] + options + end end end end Modified: test/plugin/groonga/test_table_create.rb (+13 -0) =================================================================== --- test/plugin/groonga/test_table_create.rb 2013-07-11 10:47:32 +0900 (c6a3e88) +++ test/plugin/groonga/test_table_create.rb 2013-07-11 10:54:48 +0900 (f86b452) @@ -93,4 +93,17 @@ table_create Books TABLE_NO_KEY SCHEMA end end + + class KeyTypeTest < self + def test_key_type + request = { + "name" => "Books", + "key_type" => "Int32", + } + @handler.table_create(request) + assert_equal(<<-SCHEMA, dump) +table_create Books TABLE_HASH_KEY --key_type Int32 + SCHEMA + end + end end -------------- next part -------------- HTML����������������������������...Download