superfly / fly

Deploy app servers close to your users. Package your app as a Docker image, and launch it in 17 cities with one simple CLI.

Home Page:https://fly.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add collection.keys() to list the keys in the data collection

ben-pr-p opened this issue · comments

commented

Hey there –

Would it be possible to get a collection.keys() method that listed the keys I've set via @fly.data? Right now I only see del, get, put, and deleteCollection. I could make a separate entry that lists the keys as a JSON encoded array, but I'd prefer not to store all of that!

Thanks for all your hard work!

That's a good idea!

@ben-pr-p There is an old pre-release version of this in the data-getall branch, but it will only work for local dev.

The nature of these kinds of ops means we have to limit what it can return. We can't scan and return an abitrary number of keys until we get support for cursors in, so getAll(prefix) will only return 100 or so right now. We could pretty easily support getAll(prefix, startAt) to let you page through things without a cursor, however.

If you want to help out with that branch, a PR would be awesome. These are the places that need to change:

Most of the changes in the data-getall branch should be easy to move over: https://github.com/superfly/fly/tree/data-getall