在immudb中,我们可以在执行`Get`查询之前知道某个特定键是否可用吗?

huangapple go评论78阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2022年3月9日 23:14:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/71411639.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定