fluent-plugin-dynamodb-alt 0.1.2 → 0.1.3

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: def6475b444e76ca66d619f4fea1f814a4c64431
4
- data.tar.gz: 3f83b0bd39fe53f813f2b8273b5e2e39392145da
3
+ metadata.gz: c7a92c9fe9a41c6c1c7360d796a22cf7fd235259
4
+ data.tar.gz: 090c2a1de0e08e5730119dcc49e896556493f8b1
5
5
  SHA512:
6
- metadata.gz: 552cd086584a6edcf30139cb6b6ea4b9081c2913592cd1381e3abe360a1f52958b4a0a4e2f62597d16ee4bc2a98c46536047a552403c792fbcf1f55e5fd04b07
7
- data.tar.gz: 6eab1ab0f0540f685264fb2ec7190e2c177ebd7a41ea31dbb149b09aa63390fe17e3727fb2279dc00eb7310cebcb0da392b2c3796c3569407524fb47aa795cec
6
+ metadata.gz: 84e9d9b2747a0bf6570efaa56e1ec49892032572cfa1380cc424bd30e5e9622ec3b9f1d11eca669a0189d2dc5d96ee3e1578b35b8a997af544dcb043d01e6be7
7
+ data.tar.gz: e73846a99a68e9033ee3a92a9300b7c987d148b5464e8655e9ecbcf6fadabe843356641d845483015ea591f59938c2cc12bebc528045f6ec596cf44020db59f5
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'fluent-plugin-dynamodb-alt'
7
- spec.version = '0.1.2'
7
+ spec.version = '0.1.3'
8
8
  spec.authors = ['Genki Sugawara']
9
9
  spec.email = ['sgwr_dts@yahoo.co.jp']
10
10
  spec.summary = %q{Fluent plugin to output to DynamoDB.}
@@ -28,6 +28,7 @@ class Fluent::DynamodbAltOutput < Fluent::BufferedOutput
28
28
  super
29
29
  require 'aws-sdk-core'
30
30
  require 'parallel'
31
+ require 'set'
31
32
  require 'stringio'
32
33
  end
33
34
 
@@ -111,6 +112,7 @@ class Fluent::DynamodbAltOutput < Fluent::BufferedOutput
111
112
 
112
113
  def put_record(record)
113
114
  convert_binary!(record)
115
+ convert_set!(record)
114
116
 
115
117
  item = {
116
118
  :table_name => @table_name,
@@ -220,4 +222,14 @@ class Fluent::DynamodbAltOutput < Fluent::BufferedOutput
220
222
 
221
223
  return record
222
224
  end
225
+
226
+ def convert_set!(record)
227
+ record.each do |key, val|
228
+ if val.kind_of?(Array)
229
+ record[key] = Set.new(val)
230
+ end
231
+ end
232
+
233
+ return record
234
+ end
223
235
  end
@@ -479,5 +479,26 @@ describe Fluent::DynamodbAltOutput do
479
479
  ]
480
480
  end
481
481
  }
482
+
483
+ context('set') {
484
+ it do
485
+ run_driver do |d|
486
+ d.emit({'id' => '12345678-1234-1234-1234-123456789001', 'timestamp' => 1409534625001, 'set' => [1, 2, 3]}, time)
487
+ d.emit({'id' => '12345678-1234-1234-1234-123456789002', 'timestamp' => 1409534625002, 'set' => ['1', '2', '3']}, time)
488
+ d.emit({'id' => '12345678-1234-1234-1234-123456789003', 'timestamp' => 1409534625003, 'set' => ['A', 'B', 'C']}, time)
489
+ end
490
+
491
+ rows = select_all.map do |row|
492
+ row['set'].sort!
493
+ row
494
+ end
495
+
496
+ expect(rows).to match_array [
497
+ {"id"=>"12345678-1234-1234-1234-123456789001", "timestamp"=>1409534625001, "set"=>[1, 2, 3]},
498
+ {"id"=>"12345678-1234-1234-1234-123456789002", "timestamp"=>1409534625002, "set"=>['1', '2', '3']},
499
+ {"id"=>"12345678-1234-1234-1234-123456789003", "timestamp"=>1409534625003, "set"=>['A', 'B', 'C']},
500
+ ]
501
+ end
502
+ }
482
503
  }
483
504
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-dynamodb-alt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-04 00:00:00.000000000 Z
11
+ date: 2014-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd