Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Allows performing chunked queries with DataMapper.
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.document Be explicit.
.gitignore
.rspec Initial commit.
.yardopts
ChangeLog.md
Gemfile
LICENSE.txt
README.md
Rakefile
dm-chunked_query.gemspec Fixed the gemspec.
gemspec.yml Fixed the development dependencies.

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.