dynamodb-api 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -4
- data/CHANGELOG.md +5 -0
- data/Dockerfile +15 -0
- data/README.md +30 -6
- data/docker-compose.yml +6 -0
- data/lib/dynamodb/api/config.rb +5 -0
- data/lib/dynamodb/api/delete/item.rb +5 -1
- data/lib/dynamodb/api/delete/tables.rb +1 -0
- data/lib/dynamodb/api/put/item.rb +5 -1
- data/lib/dynamodb/api/relation/from_clause.rb +2 -4
- data/lib/dynamodb/api/update/base.rb +1 -1
- data/lib/dynamodb/api/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7fc7f62b75b2847e3b61765cffcc823b1af80a09f202cceef1a74d3a549de43
|
4
|
+
data.tar.gz: e1a80833c322c480c084fe33512db8012f25f683147de888e40f6a6d046677d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e3a874f279f32c37b16a77ba649aa9cfc83615103f5df9b58a64a06496e796d31396728e0e0e1c6d7bc6538ea0be5c02c49249933f6c4bfc830f71498b88a89
|
7
|
+
data.tar.gz: 9628ccc8dc2ff42c0ec495a5485546091f82e29ba1895e4345c1a7a31d7a2298f629a7e4370caeb51e6966c4076aba9cadc81e7500c0595c82a1c867d205b171
|
data/.travis.yml
CHANGED
@@ -10,10 +10,7 @@ gemfile:
|
|
10
10
|
- gemfiles/aws_sdk_3.gemfile
|
11
11
|
|
12
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
|
13
|
+
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
17
14
|
- gem install bundler -v 1.16.2
|
18
15
|
|
19
16
|
before_script:
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
8
8
|
|
9
9
|
---
|
10
10
|
|
11
|
+
## [0.8.1] - 2019-06-03
|
12
|
+
### Fixed
|
13
|
+
- [#49](https://github.com/walkersumida/dynamodb-api/pull/49) not be added table name prefix
|
14
|
+
- [#48](https://github.com/walkersumida/dynamodb-api/pull/48) Improvement DX
|
15
|
+
|
11
16
|
## [0.8.0] - 2019-03-03
|
12
17
|
### Added
|
13
18
|
- [#39](https://github.com/walkersumida/dynamodb-api/pull/39) `next` method
|
data/Dockerfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
FROM ruby:2.5.5
|
2
|
+
|
3
|
+
ENV APP_ROOT /app
|
4
|
+
WORKDIR $APP_ROOT
|
5
|
+
|
6
|
+
COPY . $APP_ROOT
|
7
|
+
|
8
|
+
RUN \
|
9
|
+
echo 'gem: --no-document' >> ~/.gemrc && \
|
10
|
+
cp ~/.gemrc /etc/gemrc && \
|
11
|
+
chmod uog+r /etc/gemrc && \
|
12
|
+
bundle config --global build.nokogiri --use-system-libraries && \
|
13
|
+
bundle config --global jobs 4 && \
|
14
|
+
bin/setup && \
|
15
|
+
rm -rf ~/.gem
|
data/README.md
CHANGED
@@ -74,8 +74,33 @@ items = scan.all.items
|
|
74
74
|
|3 |3 |Model S |0.20120601e8 |0 |
|
75
75
|
|4 |1 |S2000 |0.19980101e8 |1 |
|
76
76
|
|
77
|
+
#### Filter
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
scan = Dynamodb::Api.scan
|
81
|
+
scan.from('cars').
|
82
|
+
filter('model = :model', ':model': 'S2000')
|
83
|
+
items = scan.all.items
|
84
|
+
```
|
85
|
+
|
86
|
+
| id | maker_id(Partition key) | model | release_date(Sort key) | status |
|
87
|
+
|:---|:---|:---|:---|:---|
|
88
|
+
|4 |1 |S2000 |0.19980101e8 |1 |
|
89
|
+
|
90
|
+
#### Limit
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
scan = Dynamodb::Api.scan
|
94
|
+
scan.from('cars').
|
95
|
+
limit(1)
|
96
|
+
items = scan.all.items
|
97
|
+
```
|
98
|
+
|
99
|
+
| id | maker_id(Partition key) | model | release_date(Sort key) | status |
|
100
|
+
|:---|:---|:---|:---|:---|
|
101
|
+
|1 |1 |Accord |0.19760508e8 |0 |
|
77
102
|
|
78
|
-
#### Next(Paging)
|
103
|
+
#### Next(Paging)
|
79
104
|
|
80
105
|
```ruby
|
81
106
|
scan = Dynamodb::Api.scan
|
@@ -164,7 +189,7 @@ items = query.all.items
|
|
164
189
|
|:---|:---|:---|:---|:---|
|
165
190
|
|1 |1 |Accord |0.19760508e8 |0 |
|
166
191
|
|
167
|
-
#### Next(Paging)
|
192
|
+
#### Next(Paging)
|
168
193
|
|
169
194
|
```ruby
|
170
195
|
query = Dynamodb::Api.query
|
@@ -260,11 +285,10 @@ client.create_backup(
|
|
260
285
|
## Development
|
261
286
|
|
262
287
|
- Run `docker-compose up` to run the dynamodb_local.
|
263
|
-
-
|
264
|
-
-
|
265
|
-
- You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
288
|
+
- Run `docker-compose run ruby bundle exec rake spec` to run the tests. Or run `docker-compose run ruby bundle exec appraisal aws-sdk-* rake spec` to run the tests. Replase `*` with aws sdk major version.
|
289
|
+
- You can also run `docker-compose run ruby bin/console` for an interactive prompt that will allow you to experiment.
|
266
290
|
|
267
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
291
|
+
To install this gem onto your local machine, run `docker-compose run ruby bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `docker-compose run ruby bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
268
292
|
|
269
293
|
## Contributing
|
270
294
|
|
data/docker-compose.yml
CHANGED
data/lib/dynamodb/api/config.rb
CHANGED
@@ -15,6 +15,11 @@ module Dynamodb
|
|
15
15
|
option :retry_limit, default: 10
|
16
16
|
option :table_name_prefix, default: ''
|
17
17
|
option :index_name_prefix, default: ''
|
18
|
+
|
19
|
+
def build_table_name(value)
|
20
|
+
return value unless table_name_prefix?
|
21
|
+
"#{table_name_prefix}#{value}"
|
22
|
+
end
|
18
23
|
end
|
19
24
|
end
|
20
25
|
end
|
@@ -3,9 +3,13 @@
|
|
3
3
|
module Dynamodb
|
4
4
|
module Api
|
5
5
|
module Delete
|
6
|
-
class Item
|
6
|
+
class Item
|
7
|
+
# @param key [Hash] the item key
|
8
|
+
# @param table_name [String] the table name
|
7
9
|
def self.delete_item(key, table_name)
|
8
10
|
client = Adapter.client
|
11
|
+
table_name = Dynamodb::Api::Config.build_table_name(table_name)
|
12
|
+
|
9
13
|
client.delete_item(key: key, table_name: table_name)
|
10
14
|
end
|
11
15
|
end
|
@@ -3,9 +3,13 @@
|
|
3
3
|
module Dynamodb
|
4
4
|
module Api
|
5
5
|
module Put
|
6
|
-
class Item
|
6
|
+
class Item
|
7
|
+
# @param key [Hash] the item key
|
8
|
+
# @param table_name [String] the table name
|
7
9
|
def self.put_item(item, table_name)
|
8
10
|
client = Adapter.client
|
11
|
+
table_name = Dynamodb::Api::Config.build_table_name(table_name)
|
12
|
+
|
9
13
|
client.put_item(item: item, table_name: table_name)
|
10
14
|
end
|
11
15
|
end
|
@@ -6,11 +6,9 @@ module Dynamodb
|
|
6
6
|
class FromClause # :nodoc:
|
7
7
|
attr_reader :name
|
8
8
|
|
9
|
+
# @param name [String] the table name
|
9
10
|
def initialize(name)
|
10
|
-
|
11
|
-
name = Dynamodb::Api::Config.table_name_prefix + name
|
12
|
-
end
|
13
|
-
@name = name
|
11
|
+
@name = Dynamodb::Api::Config.build_table_name(name)
|
14
12
|
end
|
15
13
|
end
|
16
14
|
end
|
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.8.
|
4
|
+
version: 0.8.1
|
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-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -138,6 +138,7 @@ files:
|
|
138
138
|
- Appraisals
|
139
139
|
- CHANGELOG.md
|
140
140
|
- CODE_OF_CONDUCT.md
|
141
|
+
- Dockerfile
|
141
142
|
- Gemfile
|
142
143
|
- LICENSE.txt
|
143
144
|
- README.md
|