cassie 1.0.0.beta.3 → 1.0.0.beta.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cassie/queries/README.md +7 -7
- data/lib/cassie/queries/statement/batches.rb +6 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b68910ecc81a9d339e0a59ee8b46adc36841089
|
4
|
+
data.tar.gz: 42a0a317184f67ad97c9d7281378fedf787eb605
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 096994330cb1cd057c68d1fc90276d682426f91b9be08939f372d9e8c980c2f0857b1fdd5db7750826fbae94caab1073576a849fff2eb8a33163cb8c697a1cd4
|
7
|
+
data.tar.gz: 28a4de6c7522a2c360af1472cc6e76d52a0b1957fe7c94a1e1460072b7b2fabcbcecaaa32b91884e91622f5c733d65c79d14ae3cf6924cb036621ff41e251c8e
|
@@ -236,37 +236,37 @@ Similar to [Rails Batching](http://guides.rubyonrails.org/v4.2/active_record_que
|
|
236
236
|
###### `fetch_each`
|
237
237
|
```
|
238
238
|
UsersQuery.new.fetch_each do |user|
|
239
|
-
#
|
239
|
+
# only 1000 queried and loaded at a time
|
240
240
|
end
|
241
241
|
```
|
242
242
|
|
243
243
|
```
|
244
244
|
UsersQuery.new.fetch_each(batch_size: 500) do |user|
|
245
|
-
#
|
245
|
+
# only 500 queried and loaded at a time
|
246
246
|
end
|
247
247
|
```
|
248
248
|
|
249
249
|
```
|
250
250
|
UsersQuery.new.fetch_each.with_index do |user, index|
|
251
|
-
#
|
251
|
+
# Enumerator chaining without a block
|
252
252
|
end
|
253
253
|
```
|
254
254
|
###### `fetch_in_batches`
|
255
255
|
```
|
256
256
|
UsersQuery.new.fetch_in_batches do |users_array|
|
257
|
-
#
|
257
|
+
# only 1000 queried and at a time
|
258
258
|
end
|
259
259
|
```
|
260
260
|
|
261
261
|
```
|
262
262
|
UsersQuery.new.fetch_in_batches(batch_size: 500) do |users_array|
|
263
|
-
#
|
263
|
+
# only 500 queried and at a time
|
264
264
|
end
|
265
265
|
```
|
266
266
|
|
267
267
|
```
|
268
268
|
UsersQuery.new.fetch_in_batches.with_index do |group, index|
|
269
|
-
#
|
269
|
+
# Enumerator chaining without a block
|
270
270
|
end
|
271
271
|
```
|
272
272
|
|
@@ -297,7 +297,7 @@ end
|
|
297
297
|
```
|
298
298
|
|
299
299
|
```ruby
|
300
|
-
UsersByUsernameQuery.new.
|
300
|
+
UsersByUsernameQuery.new.fetch_first(username: "eprothro")
|
301
301
|
=> #<User:0x007fedec219cd8 @id=123, @username="eprothro">
|
302
302
|
```
|
303
303
|
|
@@ -11,7 +11,12 @@ module Cassie::Queries::Statement
|
|
11
11
|
attr_reader :stateless_page_size
|
12
12
|
end
|
13
13
|
|
14
|
-
def fetch_each
|
14
|
+
def fetch_each(opts={})
|
15
|
+
return to_enum(:fetch_each, opts) unless block_given?
|
16
|
+
|
17
|
+
fetch_in_batches(opts) do |rows|
|
18
|
+
rows.each { |row| yield row }
|
19
|
+
end
|
15
20
|
end
|
16
21
|
|
17
22
|
# Yields each batch of records that was found by the options as an array.
|