more guides and typescript support
beenotung opened this issue · comments
The api is not completely documented in readme nor typed.
Sometime I've to look at the rust lmdb doc or dig into the examples and .h files to know about the available arguments and their meaning.
I can imagine it's lot of work to document options for each APIs and their lifecycle. Just by adding typing to the APIs is already very helpful.
I've made a typescript wrapper around node-lmdb. It helps new comers to discover available options.
The typing is not strictly following node-lmdb. The typing is more strict to prevent mistakes. For example the typing doesn't allow to beginTxn
before open
was called. Another example is it prevent calling putString
and other mutation APIs when the txn
is readOnly.
I'm not sure if it's too far from node-lmdb's original goal so before it's accepted, I'll maintain it as separate library at
https://github.com/beenotung/typestub-node-lmdb
Which API is it that you think is not documented enough? If you can identify them, maybe I can improve the docs.
Also, not exactly sure what you mean by adding typing. All of the C++ functions already check whether you pass the correct type (and number) of arguments to them. Can you clarify what you mean?
About TypeScript: it is a cool thing, but there are lots of node-lmdb users who don't use it, so I don't want node-lmdb to depend on it.
It would be nice to see documentation around the options for env.openDbi & env.open. The examples help fill in what might be missing but it is helpful to have it all documented in one place. Thank you for the great work on this library!
You have a good point. I tried to summarize the most common use cases in the README and made some examples, but I didn't have the time or resources to cover everything.
In general, with open source projects, the authors have a limited amount of time to spend on the project and users are expected to be at least a little willing to read the code. The information you are looking for can be found here: https://github.com/Venemo/node-lmdb/blob/master/src/dbi.cpp#L75
If you're willing to spend some time on improving the docs for everyone, pull requests are definitely welcome!
I'm closing this issue now. As always, pull requests are welcome to improve the documentation.