Skip to content

Commit

Permalink
table_create: support #value_type
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Aug 5, 2016
1 parent d4c8455 commit a68412c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/groonga/command/table-create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ def key_type
self[:key_type]
end

# @return [String, nil] Value type name, `nil` for no value
# table. Double array trie table always returns `nil` because
# double array trie table doesn't support value.
#
# @since 1.2.2
def value_type
self[:value_type]
end

def flags
@flags ||= (self[:flags] || "").split(/\s*\|\s*/)
end
Expand Down
12 changes: 12 additions & 0 deletions test/command/test-table-create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ def test_omitted
end
end

class ValueTypeTest < self
def test_specified
command = table_create_command({"value_type" => "UInt64"})
assert_equal("UInt64", command.value_type)
end

def test_omitted
command = table_create_command
assert_nil(command.value_type)
end
end

class FlagsTest < self
def test_multiple
command = table_create_command({"flags" => "TABLE_PAT_KEY|KEY_WITH_SIS"})
Expand Down

0 comments on commit a68412c

Please sign in to comment.