Skip to content
Allows performing chunked queries with DataMapper.
Ruby
Find file
Latest commit e9c22e5 May 27, 2012 @postmodern Fixed the gemspec.
Failed to load latest commit information.
lib
spec Added specs for each_chunk and batch. May 16, 2011
.document Be explicit. May 27, 2012
.gitignore Added a summary and description. Mar 2, 2011
.rspec Initial commit. Mar 2, 2011
.yardopts Initial commit. Mar 2, 2011
ChangeLog.md Updated the ChangeLog for 0.3.1. May 27, 2012
Gemfile Require rake ~> 0.8. May 27, 2012
LICENSE.txt Updated the copyright dates. May 27, 2012
README.md Updated the copyright dates. May 28, 2012
Rakefile Use rubygems-tasks ~> 0.1. Apr 24, 2012
dm-chunked_query.gemspec Fixed the gemspec. May 27, 2012
gemspec.yml Fixed the development dependencies. May 27, 2012

README.md

dm-chunked_query

Description

Allows performing chunked queries on DataMapper Models or Collections.

Features

  • Allows random-access to chunks within a query.
  • Can iterate through all chunks within a query.
  • Can be used for bulk-processing of resources.
  • Can also be used for pagination of resources.

Examples

Enumerate over all chunks, 20 resources per-chunk:

require 'dm-chunked_query'

MyModel.each_chunk(20) do |chunk|
  chunk.each do |resource|
    # ...
  end
end

Get the 5th chunk, containing 10 resources:

MyModel.all(:foo => 'bar').chunks(10)[5]

Process records in batches:

MyModel.batch(100) do |resource|
  # ...
end

Requirements

Install

$ gem install dm-chunked_query

Copyright

Copyright (c) 2011-2012 Hal Brodigan

See {file:LICENSE.txt} for details.

Something went wrong with that request. Please try again.