Sha256: 0a86f53dced70232097ccff2e1d09e7cb8a75e4e0ba78434d16e3f070af3c044

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

# dm-chunked_query

* [Source](http://github.com/postmodern/dm-chunked_query)
* [Issues](http://github.com/postmodern/dm-chunked_query/issues)
* [Documentation](http://rubydoc.info/gems/dm-chunked_query/frames)
* [Email](mailto:postmodern.mod3 at gmail.com)

## 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

* [dm-core](http://github.com/datamapper/dm-core#readme) ~> 1.0
* [dm-aggregates](http://github.com/datamapper/dm-aggregates#readme) ~> 1.0

## Install

    $ gem install dm-chunked_query

## Copyright

Copyright (c) 2011 Hal Brodigan

See {file:LICENSE.txt} for details.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dm-chunked_query-0.3.0 README.md