mapbox / cardboard

tile indexed geo database interface.
ISC License
52 stars 10 forks source link

Optional pagination on .list function #114

Closed rclark closed 9 years ago

rclark commented 9 years ago

Allow caller to set options on a cardboard.list() call that would allow for pagination -- there's no need for this to exist in a separate .page() function.

cardboard.list('my-dataset', function(err, features) {
  // features is everything in my-dataset
});

cardboard.list('my-dataset', { maxFeatures: 10 }, function(err, features) {
  // features is up to 10 features in my-dataset, perhaps less depending on feature sizes
});

cardboard.list('my-dataset', { start: 'some-id' }, function(err, features) {
  // features is a "page" of features starting from _the record after_ `some-id`. 
  // It will return as many features as it can since you did not specify maxFeatures
});

cc @willwhite