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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d87d5ab0ba834ae47b739ffd67820f63aa9a8437
4
- data.tar.gz: bf0d65ad99cbb6b3e096df87eac7f285639ec951
3
+ metadata.gz: 7dc1081e9542de9e793d4a83d90bf013ed27a078
4
+ data.tar.gz: cf0838d2b9841e97bc4c72808b7aff3a4a4d6c09
5
5
  SHA512:
6
- metadata.gz: ae4657b2fc2bcae4f9ca2adab1a034ccd393f8f09aeea60c7e893f7f5033cbf8e2ef34fa0f2b05d6e65340ad0fc6bc69c598dd46238e0b4b6a09b8a2fe58ec28
7
- data.tar.gz: 2e0186360b1da0c5cb2d1385ce4aef5c696a73395d23c74c6c99827e5759cc930ffd9a7c7d0306bcdb0a8f91a35fcf2bcea4aa1b5a07da737cccea7d0f243ee3
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
@@ -1,3 +1,3 @@
1
1
  module Dynamosaurus
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Dynamosaurus::DynamoBase do
4
4
  before(:all) do
5
- ENV['DYNAMODB_SUFFIX'] = "_local"
5
+ ENV['DYNAMODB_SUFFIX'] = "_local2"
6
6
 
7
7
  Aws.config = {
8
8
  :endpoint => "http://localhost:8000",
@@ -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]
@@ -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.0
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-07-19 00:00:00.000000000 Z
11
+ date: 2016-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler