ocean-dynamo 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e520e001a8732d1e8238a73c9e23e0b8f4fd5b2
4
- data.tar.gz: 921ef44f7fc8af615664f5037444a35f8fd8f4a6
3
+ metadata.gz: baf6230e55ce06186347e89a96f2bc47731ba535
4
+ data.tar.gz: 76b2653fa0a7b0fb0531686bd00e734b7539a49a
5
5
  SHA512:
6
- metadata.gz: 8ef0072ba8c6d720a0049dc4c39485f00743e9387ac9ce167d83a5f2b1bd15c0b386b14b61b8fc918fffa93dbd3a579d02cad1a7c4bd85f9397e6ebc263c8bda
7
- data.tar.gz: 9a238b2932974f82e812bec6256f78d26b2dcdcdacc5670db28ca63024f515be5617613d39cccdfc34cb74fef30b315fd94d0c62044989599e481d9fa6b534fa
6
+ metadata.gz: 6b47dc35c9f162d1aedfba10b9d622a0b32cf1bf0d2d238d23803492ad0520c0a8ee168de46ed1ac28b316149d5a2df075d4d9293bf95fa9e32c65b108a96910
7
+ data.tar.gz: d3b48140bc2053deabc9d9ccbb7b01c1624cf8dbf640e374dc971aa9911d844d37fa9e94210520349c52d580c51142d9902e47860c15cf0746d643b2d4f427d8
data/README.rdoc CHANGED
@@ -144,7 +144,7 @@ relation in a very efficient and massively scalable way.
144
144
 
145
145
  +belongs_to+ claims the range key and uses it to store its own id, which normally
146
146
  would be stored in the hash key attribute. Instead, the hash key attribute holds the
147
- guid of the parent. We have thus reversed the roles of these two fields. As a result,
147
+ id of the parent. We have thus reversed the roles of these two fields. As a result,
148
148
  all children store their parent id in the hash key, and their own id in the
149
149
  range key.
150
150
 
@@ -49,9 +49,12 @@ module OceanDynamo
49
49
  # Deletes all records without instantiating them first.
50
50
  #
51
51
  def delete_all
52
+ ean = { "#H" => table_hash_key.to_s }
53
+ ean["#R"] = table_range_key.to_s if table_range_key
52
54
  options = {
53
55
  consistent_read: true,
54
- projection_expression: table_hash_key.to_s + (table_range_key ? ", " + table_range_key.to_s : "")
56
+ projection_expression: "#H" + (table_range_key ? ", #R" : ""),
57
+ expression_attribute_names: ean
55
58
  }
56
59
  in_batches :scan, options do |attrs|
57
60
  if table_range_key
@@ -57,7 +57,7 @@ module OceanDynamo
57
57
  #
58
58
  # This method takes a block and yields it to every record in a table.
59
59
  # +message+ must be either :scan or :query.
60
- # +options+ is the hash of options to
60
+ # +options+ is the hash of options to pass to the scan or query operation.
61
61
  #
62
62
  def in_batches(message, options, &block)
63
63
  loop do
@@ -80,6 +80,7 @@ module OceanDynamo
80
80
  #
81
81
  def find_each(limit: nil, batch_size: 1000, consistent: false)
82
82
  options = { consistent_read: consistent }
83
+ batch_size = limit if limit && limit < batch_size
83
84
  options[:limit] = batch_size if batch_size
84
85
  in_batches :scan, options do |attrs|
85
86
  if limit
@@ -1,3 +1,3 @@
1
1
  module OceanDynamo
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-dynamo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson