groonga-command 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 591023da10e62aa8ae69838fa6d5a468d2d9b3a6
4
- data.tar.gz: 42e6f65a25e722c3df64f4f66abe49d2396b8533
3
+ metadata.gz: 7df61061b1bec3f363ad91e8fe391ba8c2119e41
4
+ data.tar.gz: bf5030cc2ed788ee2593a7140b808ae48b5faba8
5
5
  SHA512:
6
- metadata.gz: 1e1b13facf3a3c6bdb42f75a8cc1c0e1a0a361eafa4d942af624456a5759805f12c265003a56802b22b1ce23b167f9b5655e8c3b9b066df4ae94b67636cd586b
7
- data.tar.gz: 16dc292d5de500fdcdbcfc6ecf7a037a43230afaceab436483cebf5ca855fd9e622fc61a27ee02e41cfd1fd3cfc0dc41ae3719665a6a7fc9dc37b251c0327a98
6
+ metadata.gz: 6c25e91c32c0acefe24985db88c555dc4387b4c7fe5cdc0dbb4e08cefe66d3903907b65a2d9f81e826977278473ef4b0a7010ea3bbf592bbeba7705df4937944
7
+ data.tar.gz: 436f36f09c4a028ccbfa691d40429f3226b1648d07751940b44f1d0c256d4f0268cf82112dba1eda728738bf6235e3fb18a2fe495180182936179ac94c0d55da
data/doc/text/news.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # News
2
2
 
3
+ ## 1.1.1: 2015-02-13
4
+
5
+ ### Improvements
6
+
7
+ * {Groonga::Command::LogicalRangeFilter}: Added.
8
+ [GitHub#4] [Patch by Hiroshi Hatake]
9
+ * {Groonga::Command::LogicalCount}: Added.
10
+ [GitHub#5] [Patch by Hiroshi Hatake]
11
+
12
+ ### Fixes
13
+
14
+ * Fixed return type in YARD doc.
15
+ [GitHub#7] [Patch by Hiroshi Hatake]
16
+
3
17
  ## 1.1.0: 2015-02-09
4
18
 
5
19
  ### Improvements
@@ -0,0 +1,93 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2015 Hiroshi Hatake <hatake@clear-code.com>
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ require "groonga/command/base"
20
+
21
+ module Groonga
22
+ module Command
23
+ # A command class that represents `logical_count` command.
24
+ #
25
+ # @since 1.1.1
26
+ class LogicalCount < Base
27
+ Command.register("logical_count", self)
28
+
29
+ class << self
30
+ def parameter_names
31
+ [
32
+ :logical_table,
33
+ :shard_key,
34
+ :min,
35
+ :min_border,
36
+ :max,
37
+ :max_border,
38
+ :filter,
39
+ ]
40
+ end
41
+ end
42
+
43
+ # @return [String] `logical_table` parameter value.
44
+ #
45
+ # @since 1.1.1
46
+ def logical_table
47
+ self[:logical_table]
48
+ end
49
+
50
+ # @return [String] `shard_key` parameter value.
51
+ #
52
+ # @since 1.1.1
53
+ def shard_key
54
+ self[:shard_key]
55
+ end
56
+
57
+ # @return [String] `min` parameter value.
58
+ #
59
+ # @since 1.1.1
60
+ def min
61
+ self[:min]
62
+ end
63
+
64
+ # @return [String] `min_border` parameter value.
65
+ #
66
+ # @since 1.1.1
67
+ def min_border
68
+ self[:min_border]
69
+ end
70
+
71
+ # @return [String] `max` parameter value.
72
+ #
73
+ # @since 1.1.1
74
+ def max
75
+ self[:max]
76
+ end
77
+
78
+ # @return [String] `max_border` parameter value.
79
+ #
80
+ # @since 1.1.1
81
+ def max_border
82
+ self[:max_border]
83
+ end
84
+
85
+ # @return [String] `filter` parameter value.
86
+ #
87
+ # @since 1.1.1
88
+ def filter
89
+ self[:filter]
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,129 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2015 Hiroshi Hatake <hatake@clear-code.com>
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ require "groonga/command/base"
20
+
21
+ module Groonga
22
+ module Command
23
+ # A command class that represents `logical_count` command.
24
+ #
25
+ # @since 1.1.1
26
+ class LogicalRangeFilter < Base
27
+ Command.register("logical_range_filter", self)
28
+
29
+ class << self
30
+ def parameter_names
31
+ [
32
+ :logical_table,
33
+ :shard_key,
34
+ :min,
35
+ :min_border,
36
+ :max,
37
+ :max_border,
38
+ :order,
39
+ :offset,
40
+ :limit,
41
+ :filter,
42
+ :output_columns,
43
+ ]
44
+ end
45
+ end
46
+
47
+ # @return [String] `logical_table` parameter value.
48
+ #
49
+ # @since 1.1.1
50
+ def logical_table
51
+ self[:logical_table]
52
+ end
53
+
54
+ # @return [String] `shard_key` parameter value.
55
+ #
56
+ # @since 1.1.1
57
+ def shard_key
58
+ self[:shard_key]
59
+ end
60
+
61
+ # @return [String] `min` parameter value.
62
+ #
63
+ # @since 1.1.1
64
+ def min
65
+ self[:min]
66
+ end
67
+
68
+ # @return [String] `min_border` parameter value.
69
+ #
70
+ # @since 1.1.1
71
+ def min_border
72
+ self[:min_border]
73
+ end
74
+
75
+ # @return [String] `max` parameter value.
76
+ #
77
+ # @since 1.1.1
78
+ def max
79
+ self[:max]
80
+ end
81
+
82
+ # @return [String] `max_border` parameter value.
83
+ #
84
+ # @since 1.1.1
85
+ def max_border
86
+ self[:max_border]
87
+ end
88
+
89
+ # @return [String] `order` parameter value.
90
+ #
91
+ # @since 1.1.1
92
+ def order
93
+ self[:order]
94
+ end
95
+
96
+ # @return [Integer] `offset` parameter value.
97
+ #
98
+ # @since 1.1.1
99
+ def offset
100
+ value = self[:offset]
101
+ value = value.to_i unless value.nil?
102
+ value
103
+ end
104
+
105
+ # @return [Integer] `limit` parameter value.
106
+ #
107
+ # @since 1.1.1
108
+ def limit
109
+ value = self[:limit]
110
+ value = value.to_i unless value.nil?
111
+ value
112
+ end
113
+
114
+ # @return [String] `filter` parameter value.
115
+ #
116
+ # @since 1.1.1
117
+ def filter
118
+ self[:filter]
119
+ end
120
+
121
+ # @return [String] `output_columns` parameter value.
122
+ #
123
+ # @since 1.1.1
124
+ def output_columns
125
+ self[:output_columns]
126
+ end
127
+ end
128
+ end
129
+ end
@@ -83,7 +83,7 @@ module Groonga
83
83
  self[:max_border]
84
84
  end
85
85
 
86
- # @return [String] `offset` parameter value.
86
+ # @return [Integer] `offset` parameter value.
87
87
  #
88
88
  # @since 1.1.0
89
89
  def offset
@@ -92,7 +92,7 @@ module Groonga
92
92
  value
93
93
  end
94
94
 
95
- # @return [String] `limit` parameter value.
95
+ # @return [Integer] `limit` parameter value.
96
96
  #
97
97
  # @since 1.1.0
98
98
  def limit
@@ -18,6 +18,6 @@
18
18
 
19
19
  module Groonga
20
20
  module Command
21
- VERSION = "1.1.0"
21
+ VERSION = "1.1.1"
22
22
  end
23
23
  end
@@ -28,6 +28,8 @@ require "groonga/command/delete"
28
28
  require "groonga/command/dump"
29
29
  require "groonga/command/get"
30
30
  require "groonga/command/load"
31
+ require "groonga/command/logical-count"
32
+ require "groonga/command/logical-range-filter"
31
33
  require "groonga/command/normalize"
32
34
  require "groonga/command/range-filter"
33
35
  require "groonga/command/register"
@@ -0,0 +1,99 @@
1
+ # Copyright (C) 2015 Hiroshi Hatake <hatake@clear-code.com>
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class LogicalCountCommandTest < Test::Unit::TestCase
18
+ private
19
+ def logical_count_command(pair_arguments={}, ordered_arguments=[])
20
+ Groonga::Command::LogicalCount.new("logical_count",
21
+ pair_arguments,
22
+ ordered_arguments)
23
+ end
24
+
25
+ class ConstructorTest < self
26
+ def test_ordered_arguments
27
+ logical_table = "Logs"
28
+ shard_key = "timestamp"
29
+ min = "2015-02-12 00:00:00"
30
+ min_border = "include"
31
+ max = "2015-02-13 00:00:00"
32
+ max_border = "exclude"
33
+ filter = "message == \"Shutdown\""
34
+
35
+ ordered_arguments = [
36
+ logical_table,
37
+ shard_key,
38
+ min,
39
+ min_border,
40
+ max,
41
+ max_border,
42
+ filter,
43
+ ]
44
+ command = logical_count_command({}, ordered_arguments)
45
+ assert_equal({
46
+ :logical_table => logical_table,
47
+ :shard_key => shard_key,
48
+ :min => min,
49
+ :min_border => min_border,
50
+ :max => max,
51
+ :max_border => max_border,
52
+ :filter => filter,
53
+ },
54
+ command.arguments)
55
+ end
56
+ end
57
+
58
+ class LogicalTableTest < self
59
+ def test_reader
60
+ command = logical_count_command(:logical_table => "Logs")
61
+ assert_equal("Logs", command.logical_table)
62
+ end
63
+ end
64
+
65
+ class ShardKeyTest < self
66
+ def test_reader
67
+ command = logical_count_command(:shard_key => "timestamp")
68
+ assert_equal("timestamp", command.shard_key)
69
+ end
70
+ end
71
+
72
+ class MinTest < self
73
+ def test_reader
74
+ command = logical_count_command(:min => "2015-02-13 00:00:00")
75
+ assert_equal("2015-02-13 00:00:00", command.min)
76
+ end
77
+ end
78
+
79
+ class MinBorderTest < self
80
+ def test_reader
81
+ command = logical_count_command(:min_border => "include")
82
+ assert_equal("include", command.min_border)
83
+ end
84
+ end
85
+
86
+ class MaxTest < self
87
+ def test_reader
88
+ command = logical_count_command(:max => "2015-02-13 00:00:00")
89
+ assert_equal("2015-02-13 00:00:00", command.max)
90
+ end
91
+ end
92
+
93
+ class FilterTest < self
94
+ def test_reader
95
+ command = logical_count_command(:filter => "message == \"Shutdown\"")
96
+ assert_equal("message == \"Shutdown\"", command.filter)
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,139 @@
1
+ # Copyright (C) 2015 Hiroshi Hatake <hatake@clear-code.com>
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class LogicalRangeFilterCommandTest < Test::Unit::TestCase
18
+ private
19
+ def logical_range_filter_command(pair_arguments={}, ordered_arguments=[])
20
+ Groonga::Command::LogicalRangeFilter.new("logical_range_filter",
21
+ pair_arguments,
22
+ ordered_arguments)
23
+ end
24
+
25
+ class ConstructorTest < self
26
+ def test_ordered_arguments
27
+ logical_table = "Logs"
28
+ shard_key = "timestamp",
29
+ min = "2015-02-12 00:00:00"
30
+ min_border = "include"
31
+ max = "2015-02-13 00:00:00"
32
+ max_border = "exclude"
33
+ order = "ascending"
34
+ offset = "10"
35
+ limit = "20"
36
+ filter = "value == 10"
37
+ output_columns = "_key, timestamp"
38
+
39
+ ordered_arguments = [
40
+ logical_table,
41
+ shard_key,
42
+ min,
43
+ min_border,
44
+ max,
45
+ max_border,
46
+ order,
47
+ offset,
48
+ limit,
49
+ filter,
50
+ output_columns,
51
+ ]
52
+ command = logical_range_filter_command({}, ordered_arguments)
53
+ assert_equal({
54
+ :logical_table => logical_table,
55
+ :shard_key => shard_key,
56
+ :min => min,
57
+ :min_border => min_border,
58
+ :max => max,
59
+ :max_border => max_border,
60
+ :order => order,
61
+ :offset => offset,
62
+ :limit => limit,
63
+ :filter => filter,
64
+ :output_columns => output_columns,
65
+ },
66
+ command.arguments)
67
+ end
68
+ end
69
+
70
+ class LogicalTableTest < self
71
+ def test_reader
72
+ command = logical_range_filter_command(:logical_table => "Logs")
73
+ assert_equal("Logs", command.logical_table)
74
+ end
75
+ end
76
+
77
+ class ShardKeyTest < self
78
+ def test_reader
79
+ command = logical_range_filter_command(:shard_key => "timestamp")
80
+ assert_equal("timestamp", command.shard_key)
81
+ end
82
+ end
83
+
84
+ class MinTest < self
85
+ def test_reader
86
+ command = logical_range_filter_command(:min => "2015-02-13 00:00:00")
87
+ assert_equal("2015-02-13 00:00:00", command.min)
88
+ end
89
+ end
90
+
91
+ class MaxTest < self
92
+ def test_reader
93
+ command = logical_range_filter_command(:max => "2015-01-26 00:00:00")
94
+ assert_equal("2015-01-26 00:00:00", command.max)
95
+ end
96
+ end
97
+
98
+ class MaxBorderTest < self
99
+ def test_reader
100
+ command = logical_range_filter_command(:max_border => "include")
101
+ assert_equal("include", command.max_border)
102
+ end
103
+ end
104
+
105
+ class OrderTest < self
106
+ def test_reader
107
+ command = logical_range_filter_command(:order => "descending")
108
+ assert_equal("descending", command.order)
109
+ end
110
+ end
111
+
112
+ class OffsetTest < self
113
+ def test_reader
114
+ command = logical_range_filter_command(:offset => "10")
115
+ assert_equal(10, command.offset)
116
+ end
117
+ end
118
+
119
+ class LimitTest < self
120
+ def test_reader
121
+ command = logical_range_filter_command(:limit => "20")
122
+ assert_equal(20, command.limit)
123
+ end
124
+ end
125
+
126
+ class FilterTest < self
127
+ def test_reader
128
+ command = logical_range_filter_command(:filter => "value == 10")
129
+ assert_equal("value == 10", command.filter)
130
+ end
131
+ end
132
+
133
+ class OutputColumnsTest < self
134
+ def test_reader
135
+ command = logical_range_filter_command(:output_columns => "_key, timestamp")
136
+ assert_equal("_key, timestamp", command.output_columns)
137
+ end
138
+ end
139
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groonga-command
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-09 00:00:00.000000000 Z
11
+ date: 2015-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -149,6 +149,8 @@ files:
149
149
  - lib/groonga/command/format/uri.rb
150
150
  - lib/groonga/command/get.rb
151
151
  - lib/groonga/command/load.rb
152
+ - lib/groonga/command/logical-count.rb
153
+ - lib/groonga/command/logical-range-filter.rb
152
154
  - lib/groonga/command/normalize.rb
153
155
  - lib/groonga/command/range-filter.rb
154
156
  - lib/groonga/command/register.rb
@@ -175,6 +177,8 @@ files:
175
177
  - test/command/test-dump.rb
176
178
  - test/command/test-get.rb
177
179
  - test/command/test-load.rb
180
+ - test/command/test-logical-count.rb
181
+ - test/command/test-logical-range-filter.rb
178
182
  - test/command/test-normalize.rb
179
183
  - test/command/test-range-filter.rb
180
184
  - test/command/test-register.rb
@@ -218,31 +222,33 @@ specification_version: 4
218
222
  summary: Groonga-command is a library that represents [Groonga](http://groonga.org/)'s
219
223
  command. You can write a program that handle Groonga's command by using groonga-command.
220
224
  test_files:
225
+ - test/run-test.rb
226
+ - test/command/test-suggest.rb
227
+ - test/command/test-base.rb
228
+ - test/command/test-delete.rb
229
+ - test/command/test-normalize.rb
221
230
  - test/command/test-column-remove.rb
222
- - test/command/test-range-filter.rb
223
- - test/command/test-table-remove.rb
224
- - test/command/test-column-rename.rb
225
- - test/command/test-column-create.rb
226
- - test/command/test-select.rb
227
231
  - test/command/test-table-tokenize.rb
228
- - test/command/test-suggest.rb
232
+ - test/command/test-tokenize.rb
233
+ - test/command/test-dump.rb
229
234
  - test/command/test-request-cancel.rb
235
+ - test/command/test-column-rename.rb
236
+ - test/command/test-table-remove.rb
237
+ - test/command/test-get.rb
238
+ - test/command/test-truncate.rb
239
+ - test/command/test-logical-range-filter.rb
230
240
  - test/command/test-column-list.rb
241
+ - test/command/test-range-filter.rb
231
242
  - test/command/test-load.rb
232
- - test/command/test-dump.rb
233
- - test/command/test-truncate.rb
234
- - test/command/test-delete.rb
243
+ - test/command/test-table-create.rb
235
244
  - test/command/test-ruby-load.rb
236
- - test/command/test-base.rb
245
+ - test/command/test-register.rb
237
246
  - test/command/test-table-rename.rb
238
- - test/command/test-normalize.rb
239
- - test/command/test-get.rb
240
- - test/command/format/test-command.rb
241
- - test/command/test-tokenize.rb
242
- - test/command/test-ruby-eval.rb
243
247
  - test/command/test-status.rb
244
- - test/command/test-register.rb
245
- - test/command/test-table-create.rb
246
- - test/run-test.rb
248
+ - test/command/test-logical-count.rb
249
+ - test/command/test-select.rb
250
+ - test/command/test-ruby-eval.rb
251
+ - test/command/format/test-command.rb
252
+ - test/command/test-column-create.rb
247
253
  - test/groonga-command-test-utils.rb
248
254
  has_rdoc: