history-tools
history-tools copied to clipboard
query descending order
What is the proper way to query in descending order: from newest to oldest? I tried to check /v1/history/get_actions
to see how that was done and even those results are returned ascending order: from oldest to newest.
Any update on this. This is still a problem for me. Thank you
We stopped development on the legacy /v1/history
api.
Ok thank you for the reply, but the question was not specific to /v1/history
but more of a broader question. How can you query in descending order?
When writing a wasm-ql query handler (C++): both the old-style CDT table API and the new-style CDT KV table API provide support for C++ reverse iteration.
I would be very appreciative of an example. I have looked and cannot find one anywhere.
multi_index
's rbegin()
and rend()
methods. I don't know of any examples, but they behave similar to the C++ standard containers' rbegin()
and rend()
methods:
https://developers.eos.io/manuals/eosio.cdt/latest/classeosio_1_1multi__index#function-rbegin
The kv tables have similarly-named methods.
I dont understand how that link applies. I have been struggling with this for a while, and this is a common enough requirement that others will also benefit from some instruction of how to do this.
Am I meant to be modifying database.hpp
somewhere with the rbegin()
and rend()
methods?
database.hpp
is obsolete. I don't believe I got around to adding reverse iteration support to it before dumping that API and switching to the 2 CDT table APIs.
any examples of 2 CDT table APIs
?
Also I take back my reference to database.hpp
. My question is a broader, How can this be done?
See the top of the readme on this branch: https://github.com/EOSIO/history-tools/tree/idea
No examples have made it into the public repos yet for the current direction. The basic idea of the current direction:
- nodeos on the eos
develop
branch supports actions returning values. A wasm-ql query is just an action on a contract that returns a result without mutating data. - both nodeos and rodes can run wasm-ql queries.
- rodeos adds parallel execution and filter wasm support.
If you know how to access a table from within an action, you already know how to write a query. Note that hard forks have to be activated and there's a lot still missing.
I'm building out wasm-ql queries using the database.hpp and using them in a custom block explorer. Is there any re-usability from the soon-to-be deprecated wasm-ql/database.hpp stuff with regard to the new method (rodeos?) or is the method too different for any sort of refactorization?