Closed naxty closed 2 years ago
hello @naxty sorry for the late response.
As you observed, the base http api retrieves items with keys that come after the last
key (keys are sorted lexicographically) regardless if the last
key does not exist.
It behaves like this SQL query
SELECT * FROM items WHERE key>'lastKey';
Hi,
I'm currently implementing some pagination feature. In the code I found the "last" parameter in the _fetch method.
https://github.com/deta/deta-python/blob/bcf296d581a3303214332ee8ad3eb1253a085124/deta/base.py#L138
While implementing I have played around with the "last" parameter and I'm not sure if I discovered a bug or a feature. For me, it sounded like I have to provide the full provide key in order to jump to the "last" reference. But it's possible to provide just a value and then last will be used to retrieve the next values after the provided value. Check the example below where I pass "12" and retrieve other values.
As a developer I would expect that last is actually the real key and that it throws an exception if the value doesn't exists or at least have some hint in the documentation. But maybe I'm wrong. Thanks for the amazing project!