英文:
In immudb, can we know if a certain key is available before we do the `Get` query?
问题
我已经开始使用immudb做一些实验。我正在插入一些数据,它们成功地插入了。然而,如果我尝试像这样获取一个值:
const getRes = await cl.get(getReq);
我会收到一个"Key not Found"的错误。在执行Get查询之前,我如何知道某个特定的键是否可用?
英文:
I have began to do some experiments with immudb. I am inserting some data and it is inserting fine there. However, if I try to get a value like this :
const getRes = await cl.get(getReq);
I get an error "Key not Found". How can I know if a certain key is available before I do the Get query?
答案1
得分: 0
immudb没有暴露“exists”操作,但收到“key not found”错误应该不是问题。
免责声明:我是immudb的活跃贡献者,请随时在immudb GitHub存储库中为此API提出问题。
英文:
There is no "exists" operation exposed by immudb but it shouldn't be an issue to receive "key not found" error.
Disclaimer: I'm an active immudb contributor, please feel free to open an issue for this API at immudb GitHub repo.
答案2
得分: 0
根据您的用例,有时可以使用scan
操作。它将返回与给定前缀匹配的键的列表。如果您处理具有共同前缀的一组值,这可能会很有用。
英文:
Depending on your use case, sometimes you can use a scan
operation. It will give you a list of keys matching given prefix. That could be useful if you work on set of values sharing common prefix.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论