dynamodb-api 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -1
- data/CHANGELOG.md +6 -0
- data/README.md +32 -0
- data/lib/dynamodb/api/base.rb +1 -0
- data/lib/dynamodb/api/query.rb +13 -1
- data/lib/dynamodb/api/scan.rb +12 -1
- data/lib/dynamodb/api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f399f21ab0ac3eb7d980389fbf500772d9d39dbdd60b3220cc2b0cbd3adc4a6d
|
4
|
+
data.tar.gz: 6a226aa3af37bef462f46a257e3206be4a6c5529b7dc44994f20737190aa2616
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58976b0b20a9476ed7d53c56e493caa02701e4d3d2ca09eee87356e34d737558e9bce42b74c24799eb1470344d0286b891af6a97c4e8fe7c8ec4f1c272b3a761
|
7
|
+
data.tar.gz: 3f3e5af9e0afc031d122dbb0634d85c8349057ce38a04c248c5126676e4c7cc48e1bcb66943ae27470f2a7fef4d2335eef0393dc786165c4fb5c3f46ed66f7f8
|
data/.travis.yml
CHANGED
@@ -4,11 +4,17 @@ rvm:
|
|
4
4
|
- 2.3
|
5
5
|
- 2.4
|
6
6
|
- 2.5
|
7
|
+
- 2.6
|
7
8
|
gemfile:
|
8
9
|
- gemfiles/aws_sdk_2.gemfile
|
9
10
|
- gemfiles/aws_sdk_3.gemfile
|
10
11
|
|
11
|
-
before_install:
|
12
|
+
before_install:
|
13
|
+
- |
|
14
|
+
if [[ ${RUBY_VERSION} =~ ^ruby-2.3 ]]; then
|
15
|
+
gem uninstall -i /home/travis/.rvm/gems/${RUBY_VERSION}@global bundler -x
|
16
|
+
fi
|
17
|
+
- gem install bundler -v 1.16.2
|
12
18
|
|
13
19
|
before_script:
|
14
20
|
- docker-compose up -d
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
---
|
10
|
+
|
11
|
+
## [0.8.0] - 2019-03-03
|
12
|
+
### Added
|
13
|
+
- [#39](https://github.com/walkersumida/dynamodb-api/pull/39) `next` method
|
14
|
+
|
9
15
|
## [0.7.0] - 2018-12-23
|
10
16
|
### Added
|
11
17
|
- [#34](https://github.com/walkersumida/dynamodb-api/pull/34) `scan` method
|
data/README.md
CHANGED
@@ -74,6 +74,22 @@ items = scan.all.items
|
|
74
74
|
|3 |3 |Model S |0.20120601e8 |0 |
|
75
75
|
|4 |1 |S2000 |0.19980101e8 |1 |
|
76
76
|
|
77
|
+
|
78
|
+
#### Next(Paging) [Unreleased]
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
scan = Dynamodb::Api.scan
|
82
|
+
scan.from('cars').
|
83
|
+
limit(1)
|
84
|
+
_items = scan.all.items
|
85
|
+
items = scan.next.items
|
86
|
+
```
|
87
|
+
|
88
|
+
| id | maker_id(Partition key) | model | release_date(Sort key) | status |
|
89
|
+
|:---|:---|:---|:---|:---|
|
90
|
+
|2 |2 |CROWN |0.19550101e8 |0 |
|
91
|
+
|
92
|
+
|
77
93
|
### Query
|
78
94
|
https://docs.aws.amazon.com/sdkforruby/api/Aws/DynamoDB/Client.html#query-instance_method
|
79
95
|
|
@@ -148,6 +164,22 @@ items = query.all.items
|
|
148
164
|
|:---|:---|:---|:---|:---|
|
149
165
|
|1 |1 |Accord |0.19760508e8 |0 |
|
150
166
|
|
167
|
+
#### Next(Paging) [Unreleased]
|
168
|
+
|
169
|
+
```ruby
|
170
|
+
query = Dynamodb::Api.query
|
171
|
+
query.from('cars').index('index_maker_id_release_date').
|
172
|
+
where(['maker_id', '=', 1]).
|
173
|
+
order('asc'). # default: 'desc'
|
174
|
+
limit(1)
|
175
|
+
_items = query.all.items
|
176
|
+
items = query.next.items
|
177
|
+
```
|
178
|
+
|
179
|
+
| id | maker_id(Partition key) | model | release_date(Sort key) | status |
|
180
|
+
|:---|:---|:---|:---|:---|
|
181
|
+
|4 |1 |S2000 |0.19980101e8 |1 |
|
182
|
+
|
151
183
|
#### Expression Attribute Names
|
152
184
|
|
153
185
|
Words reserved in DynamoDB can not be used without special processing.
|
data/lib/dynamodb/api/base.rb
CHANGED
data/lib/dynamodb/api/query.rb
CHANGED
@@ -6,7 +6,19 @@ module Dynamodb
|
|
6
6
|
module Api
|
7
7
|
class Query < Base # :nodoc:
|
8
8
|
def all
|
9
|
-
Adapter.client.query(build_query)
|
9
|
+
result = Adapter.client.query(build_query)
|
10
|
+
@last_evaluated_key = result.last_evaluated_key
|
11
|
+
result
|
12
|
+
end
|
13
|
+
|
14
|
+
def next
|
15
|
+
return nil if @last_evaluated_key.blank?
|
16
|
+
result = Adapter.client.query(
|
17
|
+
build_query.merge(exclusive_start_key: @last_evaluated_key)
|
18
|
+
)
|
19
|
+
@last_evaluated_key = result.last_evaluated_key
|
20
|
+
return nil if result.count.zero?
|
21
|
+
result
|
10
22
|
end
|
11
23
|
|
12
24
|
private
|
data/lib/dynamodb/api/scan.rb
CHANGED
@@ -6,7 +6,18 @@ module Dynamodb
|
|
6
6
|
module Api
|
7
7
|
class Scan < Base # :nodoc:
|
8
8
|
def all
|
9
|
-
Adapter.client.scan(build_query)
|
9
|
+
result = Adapter.client.scan(build_query)
|
10
|
+
@last_evaluated_key = result.last_evaluated_key
|
11
|
+
result
|
12
|
+
end
|
13
|
+
|
14
|
+
def next
|
15
|
+
return nil if @last_evaluated_key.blank?
|
16
|
+
result = Adapter.client.scan(
|
17
|
+
build_query.merge(exclusive_start_key: @last_evaluated_key)
|
18
|
+
)
|
19
|
+
@last_evaluated_key = result.last_evaluated_key
|
20
|
+
result
|
10
21
|
end
|
11
22
|
|
12
23
|
private
|
data/lib/dynamodb/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamodb-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- WalkerSumida
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|