只查询Hyperledger Fabric的部分属性

发布于 2025-01-14 23:38:34 字数 785 浏览 1 评论 0原文

我已经构建了 Hyperledger Fabric 通道并且运行良好。但是,我只想从具有这样的数据结构的 Hyperledger 中获取一些属性,

[
  {
     "name": "name-1",
     "class": "IV-A",
     "address": "dummy st.",
     "handphone": "xxx-xxx-xxx-xxx",
     "status": "inactive"
  },
  {
     "name": "name-2",
     "class": "IV-A",
     "address": "dummy st. 7th",
     "handphone": "xxx-xxx-xxx-xxx",
     "status": "active"
  },...
]

我只想获取一些属性(名称、地址和状态),所以我们可以像这样获得返回

[
  {
     "name": "name-1",
     "address": "dummy st.",
     "status": "inactive"
  },
  {
     "name": "name-2",
     "address": "dummy st. 7th",
     "status": "active"
  },...
]

是否可以通过 hyperledger 获取这些属性直接不使用couchdb?我知道如果我们使用 couchdb,我们只需要在“emit()”中使用一些查询创建视图,但是有没有办法使用链码或选择器在超级账本中获取该视图?

先感谢您。

i've build Hyperledger Fabric channel and it was running well. But, i wanna get just some attributes only from that Hyperledger that have data structure like this

[
  {
     "name": "name-1",
     "class": "IV-A",
     "address": "dummy st.",
     "handphone": "xxx-xxx-xxx-xxx",
     "status": "inactive"
  },
  {
     "name": "name-2",
     "class": "IV-A",
     "address": "dummy st. 7th",
     "handphone": "xxx-xxx-xxx-xxx",
     "status": "active"
  },...
]

i wanna get just some attributes (name, address, and status), so we can get the return like this

[
  {
     "name": "name-1",
     "address": "dummy st.",
     "status": "inactive"
  },
  {
     "name": "name-2",
     "address": "dummy st. 7th",
     "status": "active"
  },...
]

is it possible to get those attributes via hyperledger directly without using couchdb? i know if we use couchdb we just need to create the view with some query in the "emit()", but is there any way to get that in hyperledger using chaincode or selector?

Thank you in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野心澎湃 2025-01-21 23:38:34

我不确定您的 Hyperledger Fabric 环境和数据。

但是您可以查看这个链码

或者如果您可以使用“调用函数”,您可以返回您想要的值。

return shim.Success([]byte($value))

I'm not sure about your Hyperledger Fabric environment and data.

But you can check out this chaincode.

OR if you are OK to use 'invoke function', you can return value what you want.

return shim.Success([]byte($value))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文