dynamosaurus 0.1.0 → 0.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 +4 -4
- data/lib/dynamosaurus/dynamo_class.rb +5 -2
- data/lib/dynamosaurus/version.rb +1 -1
- data/spec/dynamo_base_spec.rb +1 -1
- data/spec/dynamo_class_spec.rb +2 -2
- data/spec/dynamosaurus_spec.rb +13 -0
- data/spec/testmodel.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dc1081e9542de9e793d4a83d90bf013ed27a078
|
4
|
+
data.tar.gz: cf0838d2b9841e97bc4c72808b7aff3a4a4d6c09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd87d68c513bb65cac1b6f35930ad091a041e003eb7a4cde30d6c48f7bfd9a83cd79b19f755b8bf4fc7a4c729a95ba87f42711d65d1fffb82dfbe8452a6a035a
|
7
|
+
data.tar.gz: b85f95d99e85345f4beef1de0c576a721caa158c2eabf20d3b7c81dc574f3b912c158ebfebc3c47ada65c0cded9bb31e9d18336fda2b457a8032b04f2ce938d7
|
@@ -334,9 +334,12 @@ module Dynamosaurus
|
|
334
334
|
|
335
335
|
def query keys, index=nil, option={}
|
336
336
|
query = {
|
337
|
-
:table_name => table_name
|
338
|
-
:key_conditions => keys,
|
337
|
+
:table_name => table_name
|
339
338
|
}
|
339
|
+
unless keys.nil? || keys.empty?
|
340
|
+
query[:key_conditions] = keys
|
341
|
+
end
|
342
|
+
|
340
343
|
if index
|
341
344
|
query[:index_name] = index
|
342
345
|
end
|
data/lib/dynamosaurus/version.rb
CHANGED
data/spec/dynamo_base_spec.rb
CHANGED
data/spec/dynamo_class_spec.rb
CHANGED
@@ -19,8 +19,8 @@ describe Dynamosaurus::DynamoBase do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'simple ordered kvs test' do
|
22
|
-
expect(Dynamosaurus::DynamoBase.all_models).to match_array [Like, DynamoModelWithoutTableField, DynamoModelWithTableField, Comment, SimpleOrderedKVS, SimpleKVS]
|
23
|
-
expect(Dynamosaurus::DynamoBase.tables).to match_array ["comment_local", "dynamomodelwithouttablefield_local", "like_local", "simplekvs_local", "simpleorderedkvs_local", "table_name"]
|
22
|
+
expect(Dynamosaurus::DynamoBase.all_models).to match_array [Follow, Like, DynamoModelWithoutTableField, DynamoModelWithTableField, Comment, SimpleOrderedKVS, SimpleKVS]
|
23
|
+
expect(Dynamosaurus::DynamoBase.tables).to match_array ["comment_local", "dynamomodelwithouttablefield_local", "follow_local", "like_local", "simplekvs_local", "simpleorderedkvs_local", "table_name"]
|
24
24
|
|
25
25
|
expect(SimpleOrderedKVS.table_name).to match "simpleorderedkvs_local"
|
26
26
|
expect(SimpleOrderedKVS.get_key).to match_array [:simple_key, :s, :simple_id, :s]
|
data/spec/dynamosaurus_spec.rb
CHANGED
@@ -71,6 +71,19 @@ describe Dynamosaurus do
|
|
71
71
|
batch_items = SimpleOrderedKVS.batch_get_item({:simple_key => ["key"], :simple_id => ["1", "2", "3"]})
|
72
72
|
expect(batch_items.size).to eq 1
|
73
73
|
|
74
|
+
orderd_items2 = SimpleOrderedKVS.get({
|
75
|
+
index: "updated_at_index",
|
76
|
+
},
|
77
|
+
{
|
78
|
+
scan_index_forward: false,
|
79
|
+
limit: 50,
|
80
|
+
key_condition_expression: "simple_key = :v_simple_key and updated_at > :v_updated_at",
|
81
|
+
expression_attribute_values: {
|
82
|
+
":v_simple_key" => "key",
|
83
|
+
":v_updated_at" => 0
|
84
|
+
}
|
85
|
+
})
|
86
|
+
|
74
87
|
end
|
75
88
|
|
76
89
|
it 'simple kvs test' do
|
data/spec/testmodel.rb
CHANGED
@@ -27,3 +27,10 @@ class Like < Dynamosaurus::DynamoBase
|
|
27
27
|
key :object_id, :string, :user_id, :string
|
28
28
|
global_index :user_index, :user_id, :string
|
29
29
|
end
|
30
|
+
|
31
|
+
class Follow < Dynamosaurus::DynamoBase
|
32
|
+
key :user_id, :string, :from_user_id, :string
|
33
|
+
|
34
|
+
secondary_index :updated_at_index, :updated_at, :number
|
35
|
+
global_index :from_user_index, :from_user_id, :string, :updated_at, :number
|
36
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamosaurus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Isamu Arimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|